Swing:如何在主 class 之前显示启动画面?

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

我创建了一个启动画面 class,它基本上加载并运行了一个 GIF 标题文件几秒钟。我怎样才能让它在主 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() {...

在您的主 class 中,在第一行添加对启动画面的调用。这样它将 运行 初始屏幕,然后 运行 你在主要 class.

中需要什么