import java.awt.Color;
import javax.swing.JProgressBar;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.FlowLayout;
public class JProgressBarDemo
{
public static void main (String[] args)
{
JProgressBar progressBar = new JProgressBar (JProgressBar.VERTICAL, 10, 100);
progressBar.setBackground (Color.white);
progressBar.setForeground (Color.red);
progressBar.setValue (40);
progressBar.setString ("progressBar");
JPanel panel = new JPanel (new FlowLayout (FlowLayout.LEFT));
panel.setPreferredSize (new Dimension (600,400));
panel.add (progressBar);
JFrame frame = new JFrame ("JProgressBarDemo");
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
frame.setContentPane (panel);
frame.pack();
frame.show();
}
}
评论