I was doing a bit of reading, and according to what I read, GUIs can be set up and realized in any thread, but doing more GUI work in a normal thread (non-EDT) after a call to setVisible can be dangerous. The explanation given is as follows:
The example constructs the GUI in the main thread. In general, you can construct (but not show) a GUI in any thread, as long as you don't make any calls that refer to or affect already realized components. The components in the GUI are realized by the pack call. Immediately afterward, the components in the GUI are shown with the setVisible (or show) call. Technically the setVisible call is unsafe, because the components have already been realized by the pack call. However, because the program doesn't already have a visible GUI, it's exceedingly unlikely that a paint request will occur before setVisible returns.
I couldn't find any more information on it. How could a paint request possibly occur though. . it can't occur programmatically (before setVisible returns) unless it's in a different thread, which isn't the case here, and it can't occur by user action since the window isn't visible yet. I guess that's why it says exceedingly unlikely. But anyway, why is it unsafe if a paint request occurs before setVisible returns? I'm very curious