zoukankan      html  css  js  c++  java
  • 进度条

    import java.awt.Color;
    import java.awt.EventQueue;

    import javax.swing.JFrame;
    import javax.swing.JProgressBar;
    import javax.swing.JPanel;

    public class Jindu {

    private JFrame frame;

    /**
    * Launch the application.
    */
    public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
    public void run() {
    try {
    Jindu window = new Jindu();
    window.frame.setVisible(true);
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    });
    }

    /**
    * Create the application.
    */
    public Jindu() {
    initialize();
    }

    /**
    * Initialize the contents of the frame.
    */
    private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);
    JProgressBar a= new JProgressBar();
    a.setStringPainted(true);
    JPanel panel = new JPanel();
    a.setBackground(Color.GREEN);
    panel.setBounds(49, 119, 375, 116);
    frame.getContentPane().add(panel);
    panel.add(a);
    new Thread(){

    public void run(){
    for (int i = 0; i <= 100; i++) {
    try {
    Thread.sleep(100); // 让当前线程休眠0.1ms
    } catch (InterruptedException e) {
    // TODO: handle exception
    e.printStackTrace();
    } a.setValue(i); // 设置进度条数值

    }
    a.setString("创建成功");// 设置提示信息
    }
    }.start();
    }
    }

  • 相关阅读:
    rsync
    SAMBA服务搭建
    top,job,user,file,alias
    FTP服务搭建
    shell_script2
    shell_script1
    shell_processing
    shell_advanced
    shell_basic
    docker搭建私有仓库遇到的坑 http: server gave HTTP response to HTTPS client
  • 原文地址:https://www.cnblogs.com/qiqisx/p/7652045.html
Copyright © 2011-2022 走看看