Hello,
When writing my GUI code on various projects, I sometimes run into problems updating the state of components. For instance, in one project, I may have no problem using .setEnabled(false) and the GUI updates that change. Using what I think is the same process on the next project, I use that .setEnabled(false) and the GUI is never updated.
I run the GUI using EventQueue.invokeLater(new Runnable()......... and run the time consuming work of my code in a separate
thread I create just for that work.
So my question is this: is there a rule of thumb to follow in planning how the GUI gets updated, or can I just call .setEnabled(false) in a willy-nilly fashion? I wonder if I have just been lucky to have this work at all in the past.
As a side question, how prevalent is the use of Thread.sleep to give other things a chance to run? Is this equivalent to a hack to get code to run, or is it accepted practice?
Thanks for the advice and help
BD