Java frame not displaying properly during a while loop

后端 未结 2 2079
無奈伤痛
無奈伤痛 2020-12-12 06:33

Here\'s a serious issue im having with a jFrame. I have one \"Main Frame\" where everything is done from, however i have another frame with a gif image in it (Loading, that

2条回答
  •  忘掉有多难
    2020-12-12 06:39

    You use Timer Class in java.util package and schedule timertask to close the splash screen after some time say 2 min or the task is completed.

     final Processing nc = new Processing();
     nc.setVisible(true);
     Timer timer = new Timer():
     TimerTask task = new TimerTask() {
          public void run() { 
              nc.setVisible( false );
              // to do disposing nc
          }
     };
     timer.schedule( task, 1000 * 3 ); // dispose the processing frame after 3 minutes
    

提交回复
热议问题