java - Extending Swing components to run on EDT -
for java swing components, idea extend , override constructor , calls ensure executed on event dispatch thread?
@override public void setbackground(final color c) { if(swingutilities.iseventdispatchthread()) { super.setbackground(c); } else { //force run on edt through invokeandwait or invokelater } } also (dumb question); if run new runnable within edt, run call executed (conventional top-down)?
@override public void actionperformed(actionevent e) { runnable r = new runnable() { public void run() { // update buttons } } r.run(); // runs }
Comments
Post a Comment