2018-06-27|903阅|作者:云代码会员|举报 摘要:package bar.demo;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.awt.EventQueue;
|
import javax.swing.JButton;
|
import javax.swing.JFrame;
|
import javax.swing.JScrollBar;
|
import javax.swing.JTextField;
|
import javax.swing.SwingUtilities;
|
import javax.swing.JProgressBar;
|
import javax.swing.JLabel;
|
public class JProcessBar extends JFrame {
|
public static int width = Toolkit.getDefaultToolkit().getScreenSize().width;
|
public static int height = Toolkit.getDefaultToolkit().getScreenSize().height;
|
public static int windowsWedth = 600;
|
public static int windowsHeight = 600;
|
private static final long serialVersionUID = 1L;
|
private JProgressBar progressBar = new JProgressBar();
|
private boolean state = false;
|
private Thread workThead = null;
|
private Runnable run = null;
|
public static void main(String[] args) {
|
JProcessBar jp = new JProcessBar();
|
jp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
* Create the application.
|
JLabel lblNewLabel_1 = new JLabel("");
|
* Initialize the contents of the frame.
|
private void initialize() {
|
this.setTitle("\u52A0\u8F7D\u4E2D");
|
this.setBounds((width - windowsWedth) / 2, (height - windowsHeight) / 2, 545, 186);
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
this.getContentPane().setLayout(null);
|
progressBar.setForeground(Color.BLACK);
|
progressBar.setStringPainted(true);
|
progressBar.setOpaque(false);
|
progressBar.setBounds(73, 103, 434, 24);
|
this.getContentPane().add(progressBar);
|
JLabel lblNewLabel = new JLabel("\u8FDB\u5EA6\u52A0\u8F7D\uFF1A");
|
lblNewLabel.setBounds(10, 106, 68, 15);
|
this.getContentPane().add(lblNewLabel);
|
lblNewLabel_1.setOpaque(true);
|
lblNewLabel_1.setBounds(73, 80, 235, 24);
|
getContentPane().add(lblNewLabel_1);
|
workThead = new WorkThead();
|
class WorkThead extends Thread {
|
} catch (InterruptedException e) {
|
// TODO Auto-generated catch block
|
SwingUtilities.invokeLater(new Runnable() {
|
// TODO Auto-generated method stub
|
// 更新操作通过事件派发线程完成(一般实现Runnable()接口)
|
progressBar.setValue(count);
|
lblNewLabel_1.setText("loading api-ms-win-core-xstate-l1-1-0.dll");
|
lblNewLabel_1.setText("loading MaxxAudioAPO5064.dll");
|
lblNewLabel_1.setText("loading MetroIntelGenericUIFramework.dll");
|
lblNewLabel_1.setText("loading microsoft-windows-kernel-power-events.dll");
|
lblNewLabel_1.setText("miguiresource.dll");
|
lblNewLabel_1.setText("loading mfvdsp.dll");
|
lblNewLabel_1.setText("loading miguiresource.dll");
|
lblNewLabel_1.setText("loading end");
|
Thread.currentThread().sleep(500);
|