本文整理汇总了Java中javax.swing.JProgressBar.addMouseListener方法的典型用法代码示例。如果您正苦于以下问题:Java JProgressBar.addMouseListener方法的具体用法?Java JProgressBar.addMouseListener怎么用?Java JProgressBar.addMouseListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JProgressBar
的用法示例。
在下文中一共展示了JProgressBar.addMouseListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StatusBar
import javax.swing.JProgressBar; //导入方法依赖的package包/类
public StatusBar(boolean showProgressBar) {
GridBagLayout layout = new GridBagLayout();
setLayout(layout);
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.weightx = 1;
constraints.gridwidth = 1;
constraints.insets = new Insets(0, 5, 0, 0);
layout.setConstraints(operatorLabel, constraints);
add(operatorLabel);
constraints.weightx = 0;
constraints.fill = GridBagConstraints.NONE;
constraints.gridwidth = GridBagConstraints.RELATIVE;
constraints.insets = new Insets(0, 0, 1, 5);
progressBar = new JProgressBar() {
private static final long serialVersionUID = 1L;
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
return new Dimension(500, size.height + 5);
}
@Override
public boolean isStringPainted() {
// the status bar progress bar needs to be of the same height regardless so we
// always pretend we paint the label because that affects its height
return true;
}
};
progressBar.putClientProperty(RapidLookTools.PROPERTY_PROGRESSBAR_COMPRESSED, true);
if (showProgressBar) {
progressBar.setStringPainted(false);
progressBar.setEnabled(false);
progressBar.setOpaque(false);
progressBar.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (!ProgressThreadDialog.getInstance().isVisible()) {
ProgressThreadDialog.getInstance().setVisible(true, true);
}
}
}
});
layout.setConstraints(progressBar, constraints);
add(progressBar);
}
}