Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 JButton Updates
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
1of42




PostPosted: 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
Sponsor
sponsor
rizzix




PostPosted: 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




PostPosted: 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...
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: