01: package test.check;
02:
03: import java.awt.BorderLayout;
04: import java.awt.FlowLayout;
05: import java.awt.event.ActionEvent;
06: import java.awt.event.ActionListener;
07:
08: import javax.swing.*;
09:
10: import org.jvnet.substance.skin.SubstanceBusinessBlackSteelLookAndFeel;
11:
12: public class AnimateProgressBar extends JFrame {
13: public AnimateProgressBar() {
14: this .setLayout(new BorderLayout());
15: final JProgressBar jpb = new JProgressBar(0, 15);
16: this .add(jpb, BorderLayout.CENTER);
17:
18: JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));
19: JButton forw = new JButton("Increment");
20: forw.addActionListener(new ActionListener() {
21: public void actionPerformed(ActionEvent e) {
22: jpb.setValue(jpb.getValue() + 1);
23: }
24: });
25: controls.add(forw);
26: this .add(controls, BorderLayout.SOUTH);
27:
28: this .setSize(300, 100);
29: this .setLocationRelativeTo(null);
30: this .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
31: }
32:
33: public static void main(String[] args) throws Exception {
34: UIManager
35: .setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());
36: SwingUtilities.invokeLater(new Runnable() {
37: public void run() {
38: new AnimateProgressBar().setVisible(true);
39: }
40: });
41: }
42:
43: }
|