Update JProgressBar

后端 未结 6 1547
生来不讨喜
生来不讨喜 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:55

    The best advice for your situation is to use SwingWorker. Check out the API at http://java.sun.com/javase/6/docs/api/javax/swing/SwingWorker.html

    Override process method to update value of progress bar ( then it will be done correctly on EDT)

    More info can be obtained at http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html

提交回复
热议问题