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

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -