SuspendedAnimation.run()您的内心 并不
在EDT上。那是您需要使用的地方
invokeLater(),而不是在调用时
Animate():
@Overridepublic void run(){ // We're outside the EDT in most of run() m_IsAnimationNeeded = true; for (JPanelRailoadSquare currRailoadSquare: m_PlayerRailoadPanelsTrack) { SwingUtilities.invokeAndWait(new Runnable() { // The pre that "talks" to Swing components has to be put on // the EDT currRailoadSquare.SetGoingTrain(); repaint(); }); // We want to keep sleeping outside the EDT. try { Thread.sleep(150); } catch (InterruptedException e){} SwingUtilities.invokeAndWait(new Runnable() { currRailoadSquare.UnSetGoingTrain(); repaint(); } }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)