如何等待GUI完成更新 - Swing

时间:2014-07-02 13:05:38

标签: java multithreading swing

JPanel[] panels = new JPanel[5]; // lets just say its still filled and does not just contain null to keep it short
while(true){
  for(JPanel panel : panels){
    // set the color of the panel to different colors
  }
}

我在一个永久的cyclus中着色几个面板。现在我的问题是,由于正在更新它的线程,gui的更新有延迟。现在我正在寻找一种方法来加入这个线程并等到完成之后再开始下一个cyclus

JPanel[] panels = new JPanel[5];// lets just say its still filled and does not just contain null to keep it short
while(true){
  for(JPanel panel : panels){
    // set the color of the panel to different colors
  }
  // wait until the gui-update is over
}

希望有人可以发牢骚我:) 谢谢!

0 个答案:

没有答案