/*** Use java swing progress bar * @ author gao */package com. gao; import java. awt. flowLayout; import javax. swing. JFrame; import javax. swing. JPanel; import javax. swing. JProgressBar; import javax. swing. border. emptyBorder; public class JProgressBarDemo extends JFrame {public JProgressBarDemo () {this. setTitle ("use of progress bar"); this. setdefaclocloseoperation (JFrame. EXIT_ON_CLOSE); this. setBounds (100,100,250,100); JPanel ContentPane = new JPanel (); contentPane. setBorder (new EmptyBorder (5, 5, 5); this. setContentPane (contentPane); contentPane. setLayout (new FlowLayout (FlowLayout. CENTER, 5, 5); final JProgressBar progressBar = new JProgressBar (); progressBar. setStringPainted (true); new Thread () {public void run () {for (int I = 0; I <= 100; I ++) {try {Thread. sleep (100);} catch (InterruptedException e) {e. printStackTrace ();} progr EssBar. setValue (I);} progressBar. setString ("upgrade complete! ");}}. Start (); contentPane. add (progressBar); this. setVisible (true);} public static void main (String [] args) {JProgressBarDemo example = new JProgressBarDemo ();}}