/**
* Constructor for the ProgressTest object
*/
ProgressTest() {
setLayout(new BorderLayout());
final BoundedRangeModel model = new DefaultBoundedRangeModel(0, 0, 0, 100);
JProgressBar progress = new JProgressBar(model);
add("South", progress);
JSlider slider = new JSlider(model);
add("North", slider);
slider = new JSlider(JSlider.VERTICAL);
slider.setModel(model);
add("West", slider);
progress = new JProgressBar(JProgressBar.VERTICAL);
progress.setModel(model);
add("East", progress);
new Timer(50, new ActionListener() {
int counter = 0;
public void actionPerformed(ActionEvent e) {
if (model.getValue() >= 100) {
counter += 20;
if (counter >= 500) model.setValue(0);
} else {
model.setValue(model.getValue() + 2);
counter = 0;
}
}
}).start();
}