void (String[] args) { JFrame frame = new JFrame("ColorProgressBar Test"); frame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.exit(0); } } ); frame.setSize(800, 600); frame.setLocation(0, 0); Container contentPane = frame.getContentPane(); contentPane.setLayout(new BorderLayout()); final ColorProgressBar colorProgressBar = new ColorProgressBar(); colorProgressBar.setFraction(0.5); colorProgressBar.setIndeterminate(true); contentPane.add(colorProgressBar, BorderLayout.NORTH); frame.setVisible(true); JButton b = new JButton ("X"); b.addActionListener(new ActionListener () { @Override public void actionPerformed(ActionEvent e) { colorProgressBar.setFraction(1); } }); contentPane.add(b, BorderLayout.SOUTH); }