Swing: How can I display a Splash Screen before th

2019-03-03 17:05发布

This question already has an answer here:

I've created a splash screen class which basically loads and runs a GIF title file for a couple of seconds. How would I get this to display prior to the main class?

public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            accountGUI inst = new accountGUI();
            inst.setLocationRelativeTo(null);
            inst.setVisible(true);

        }
    });
}

public accountGUI() {...

1条回答
放荡不羁爱自由
2楼-- · 2019-03-03 17:54

In your main class, add a call to your splash screen in the first line. that way it will run the splash screen, then run your what is needed in the main class.

查看更多
登录 后发表回答