Reputation: 2289
Similar to this question I have the problem that the first JFrame I open takes way longer than ones afterward. I have an application that opens JFrames based on user input in the console. Because of this, I would have time to load the JFrame stuff in advance in a separate thread. What function of Swing or AWT should I call for this initialization to be executed (the other StackOverflow answer refers to some sun package which is no longer in the JRE/JDK)?
Upvotes: 0
Views: 74
Reputation: 856
Swing: Just call everything you normally need to setup the GUI but don't invoke setVisible(true) on the JFrame until you want to display it. Note that the GUI should be created on the EDT, i.e. using SwingUtilities.invokeLater.
Upvotes: 1