本文整理汇总了Java中javax.swing.JProgressBar.addChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java JProgressBar.addChangeListener方法的具体用法?Java JProgressBar.addChangeListener怎么用?Java JProgressBar.addChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JProgressBar
的用法示例。
在下文中一共展示了JProgressBar.addChangeListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JProgressDemo
import javax.swing.JProgressBar; //导入方法依赖的package包/类
public JProgressDemo() {
frame = new JFrame("install");
frame.setLayout(new BorderLayout());
label = new JLabel("progress",SwingConstants.CENTER);
progressbar = new JProgressBar();
progressbar.setOrientation(JProgressBar.HORIZONTAL);
progressbar.setMinimum(0);
progressbar.setMaximum(100);
progressbar.setValue(0);
//progressbar.setStringPainted(true);
progressbar.addChangeListener(this);
progressbar.setPreferredSize(new Dimension(300, 10));
progressbar.setBorderPainted(false);
progressbar.setBackground(Color.pink);
JPanel progressPane = new JPanel();
progressPane.add(progressbar);
progressPane.setPreferredSize(new Dimension(300, 10));
JPanel panel = new JPanel();
b = new JButton("install");
stop = new JButton("pause");
b.setForeground(Color.blue);
b.addActionListener(this);
stop.addActionListener(this);
panel.add(b);
panel.add(stop);
// timer=new Timer(100,this);
timer = new Timer(1000/10, this);
frame.add(panel, BorderLayout.NORTH);
frame.add(progressPane, BorderLayout.CENTER);
frame.add(label, BorderLayout.SOUTH);
// frame.pack();
frame.setBounds(100, 100, 400, 130);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
示例2: subscribeActual
import javax.swing.JProgressBar; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super ChangeEvent> observer) {
JProgressBar w = widget;
ChangeEventConsumer aec = new ChangeEventConsumer(observer, w);
observer.onSubscribe(aec);
w.addChangeListener(aec);
if (aec.get() == null) {
aec.onDispose(w);
}
}
示例3: addNotificationListeners
import javax.swing.JProgressBar; //导入方法依赖的package包/类
public void addNotificationListeners(Component c) {
if (c instanceof JTextComponent) {
JTextComponent tc = (JTextComponent) c;
AXTextChangeNotifier listener = new AXTextChangeNotifier();
tc.getDocument().addDocumentListener(listener);
tc.addCaretListener(listener);
}
if (c instanceof JProgressBar) {
JProgressBar pb = (JProgressBar) c;
pb.addChangeListener(new AXProgressChangeNotifier());
} else if (c instanceof JSlider) {
JSlider slider = (JSlider) c;
slider.addChangeListener(new AXProgressChangeNotifier());
}
}
示例4: addNotificationListeners
import javax.swing.JProgressBar; //导入方法依赖的package包/类
public void addNotificationListeners(Component c) {
if (c instanceof Accessible) {
AccessibleContext ac = ((Accessible)c).getAccessibleContext();
ac.addPropertyChangeListener(new AXChangeNotifier());
}
if (c instanceof JProgressBar) {
JProgressBar pb = (JProgressBar) c;
pb.addChangeListener(new AXProgressChangeNotifier());
} else if (c instanceof JSlider) {
JSlider slider = (JSlider) c;
slider.addChangeListener(new AXProgressChangeNotifier());
}
}