简体   繁体   中英

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? 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 ,

Have to look at Swing Timer , which providing basic funkcionalities for painting in the Swing or delaying any event(s) in the 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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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