本文介绍了Swing:如何在主课前显示启动画面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个启动画面类,基本上可以加载并运行一个GIF标题文件几秒钟。如何在主课前显示?

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() {...


推荐答案

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

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.

这篇关于Swing:如何在主课前显示启动画面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-07 00:39