I'm currently looking at the EventQueue class on the Oracle website: http://download.oracle.com/javase/1.4.2/docs/api/java/awt/EventQueue.html But I'm not sure when I should use it? Should I use it if my class has listeners for two or more Events?
Normally you don't have to submit any events to the EventQueue, this all happens "automatically" when the user does his actions (like mouse clicks and such), or when the system thinks your window needs to be repainted.
The only two methods I'm using regularly are EventQueue.invokeLater
and EventQueue.invokeAndWait()
(less often). Use one of them if you are doing some action outside of the EDT (event dispatch thread) and then want to do some changes to the GUI (like adding or removing a component to/from a container), as such actions should occur only on the EDT.