Results 1 to 4 of 4
- 05-05-2009, 07:37 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 10
- Rep Power
- 0
- 05-06-2009, 12:16 AM #2
invokeLater() places an object on the Swing Event Queue. Once all current events on the queue are processed, the run() method of the object will be called, on the event processing thread.
It is used to ensure that all UI updates are concurrency-safe. So situations such as a component's colour changing while it is being painted do not occur.Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 05-06-2009, 01:30 AM #3
Senior Member
- Join Date
- Nov 2008
- Posts
- 286
- Rep Power
- 5
You essentially use invokeLater() whenever you need to update the UI and your code is not being run directly in response to a UI event (i.e. it's not inside or called directly by an actionPerformed(), mousePressed() etc method). Typically, this means your program has started some thread in the background and that background thread needs to update the UI. Subtly, it also means at the very beginning of your progam before you've started up your UI.
Some articles I've written that may help you:
- Threading with Swing
- SwingUtilities.invokeLater() - further explanation and exampleNeil Coffey
Javamex - Java tutorials and performance info
-
Similar Threads
-
Use of swingutilities.invokeLater
By neha_negi in forum AWT / SwingReplies: 2Last Post: 09-19-2008, 02:48 AM -
Creating a Thread using the Runnable interface
By Java Tip in forum java.langReplies: 0Last Post: 04-09-2008, 06:31 PM -
Error : Runnable did not complete within 10000ms
By piyushgpt1 in forum Advanced JavaReplies: 1Last Post: 02-05-2008, 07:04 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks