Darryl Burke wrote:All event dispatch in Swing occurs on the EDT. As a general rule, you should run all code that constructs and alters the state of Swing components only on the EDT.
I would also add all code that queries the state of Swing components, like calling getText() on a text field.
Luigi, you can get away with creating your user interface before the EDT is started. In your example the call to SwingUtilities.invokeLater could have been omitted; the setVisible(true) method would cause the EDT to be started. However, as Darryl said, could does not mean should.
Although I still go the lazy way and skip EventQueue.invokeLater* when constructing my GUIs a lot of the time.
*SwingUtilities.invokeLater delegates to EventQueue.invokeLater, as is also mentioned in the Javadocs.