使用構(gòu)造器JProgressBar(int orient)來創(chuàng)建進(jìn)度條。其具體的實例代碼如下:
publicclassBWF {
publicBWF(){
JFramejf=newJFrame("博為峰教育");
jf.setSize(300, 200);
JPanelcontentPane=newJPanel();
jf.setContentPane(contentPane);
JProgressBarpb=newJProgressBar(JProgressBar.VERTICAL);//創(chuàng)建一個帶垂直方向的進(jìn)度條組件
contentPane.add(newJLabel("進(jìn)度條:"));
contentPane.add(pb);
jf.setVisible(true);
jf.addWindowListener(newWindowAdapter() {
publicvoidwindowClosing(WindowEvente) {
System.exit(0);
}
});
}
publicstaticvoidmain(String[]args) {
newBWF();
}
}