Update JProgressBar

后端 未结 6 1552
生来不讨喜
生来不讨喜 2021-01-22 21:43

I can\'t update my progressbar... this is my code

Thread t=new Thread(new Runnable(){
        public void run(){
            int i=1;
            jProgBar.setMin         


        
6条回答
  •  耶瑟儿~
    2021-01-22 21:54

    Putting this snippet

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            jProgBar.repaint();
        }
    }
    

    Between 'i++' and 'Thread.sleep()' should do the job. To get it compiling, mark jProgBar as 'final'.

提交回复
热议问题