📄 dome9.java
字号:
import javax.swing.JFrame;
import java.awt.BorderLayout;
import javax.swing.JProgressBar;
import javax.swing.Timer;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Dome9 extends JFrame implements ActionListener
{
private JProgressBar pb = new JProgressBar(0, 100);
private Timer tr = new Timer(1000, this);
public Dome9()
{
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pb.setStringPainted(true);
tr.start();
this.getContentPane().setLayout(new BorderLayout());
this.getContentPane().add(pb, BorderLayout.CENTER);
this.setSize(400,300);
this.setVisible(true);
}
public static void main(String [] args)
{
new Dome9();
}
public void actionPerformed(ActionEvent e)
{
pb.setValue(pb.getValue()+1);
pb.setString("当前完成 了: "+pb.getValue()+" %");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -