Java JFrame EventQueue
- by asmo
In Java, to create and show a new JFrame, I simply do this:
public static void main(String[] args)
{
new JFrame().setVisible(true);
}
However, I saw many people doing it like this:
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
new JFrame().setVisible(true);
}
});
}
Why? Are there any advantages?