Swing: How can I display a Splash Screen before the main class? [duplicate]

点点圈 提交于 2020-01-11 14:23:09

问题


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:


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.



来源:https://stackoverflow.com/questions/29190924/swing-how-can-i-display-a-splash-screen-before-the-main-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!