JButton Updates
Author |
Message |
1of42
|
Posted: Fri Apr 29, 2005 10:19 pm Post subject: 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? |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
rizzix
|
Posted: Tue May 03, 2005 2:51 pm Post subject: (No subject) |
|
|
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
|
Posted: Tue May 03, 2005 4:19 pm Post subject: (No subject) |
|
|
Turns out there's a more hack but simpler way... in the listener:
aButton.paint(aButton.getGraphics());
Thanks for the help though... |
|
|
|
|
 |
|
|