
-----------------------------------
1of42
Fri Apr 29, 2005 10:19 pm

JButton Updates
-----------------------------------
Inside the ActionListener for a JButton, I need to disable the button, set it as selected, wait 1 second, then reset it to enabled and de-selected. This is easy enough, however, apparently JButtons do not update until the listener has finished execution. 

Is their a method or field I can change to make JButtons apply changes immediately?

-----------------------------------
rizzix
Tue May 03, 2005 2:51 pm


-----------------------------------
yea.. take a look at the javax.swing.SwingUtilities class. (mulithreaded approach)

in perticular the..
static void 	invokeAndWait(Runnable doRun)
static void 	invokeLater(Runnable doRun)

methods

-----------------------------------
1of42
Tue May 03, 2005 4:19 pm


-----------------------------------
Turns out there's a more hack but simpler way... in the listener:

aButton.paint(aButton.getGraphics());

Thanks for the help though...
