简体   繁体   English

EDT和其他Thread关系都是关于repaint()方法的java

[英]EDT and other Thread relations regard repaint() method java

if the GUI was sure build by EDT does a repaint call on some other Thread invoke painting on the EDT? 如果GUI确定由EDT构建,那么对EDT上的其他一些Thread调用绘画进行重新调用吗? if not, how do i make sure it does, the more efficient the better. 如果没有,我如何确定呢,效率越高越好。

Basically method repaint() invoke EDT by default, everything works until first Thread.sleep(int) was called, then you have an issue with Concurency in Swing , 基本上方法repaint()默认调用EDT,一切正常,直到调用第一个Thread.sleep(int) ,然后你在Swing中遇到Concurency的问题,

Have to look at Swing Timer , which providing basic funkcionalities for painting in the Swing or delaying any event(s) in the Swing GUI , 必须看看Swing Timer ,它提供Swing绘画的基本功能或延迟Swing GUI中的任何事件,

If your update(s) isn't about Graphics then you can invoke EDT by wrapping output to the Swing GUI to the invokeLater() 如果您的更新不是关于Graphics,那么您可以通过将输出包装到Swing GUI到invokeLater()来调用EDT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM