在netbeans中制作一个加载屏幕 [英] Making a loading screen in netbeans

查看:146
本文介绍了在netbeans中制作一个加载屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用一个我想要的按钮创建了一个JFrame类,因此当您按下按钮时,它将带您进入初始屏幕,而无需打开另一个JFrame.但是,我该怎么做呢?我希望新屏幕的中间有图片和正在加载的GIF吗?

I have created a JFrame class with a button i want it so when you press the button it will take you to a splash screen without opening another JFrame. But how do i do this?. I want the new screen to have a image and a Loading GIF in the middle?

推荐答案

我想做的是使用因此,当实例化Splashscreen类并调用start时,将显示方法JWindow并执行SwingWorker. JWindow将一直显示,直到完成后台处理(耗时的任务)为止.完成处理后,将显示JFrame并将处置JWindow.

So, when you instantiate Splashscreen class and call start method JWindow will be displayed and SwingWorker will be executed. JWindow will be displayed until background process (time consuming task) is done. When process is done JFrame will be displayed and JWindow will be disposed.

但是!对于您的情况,我建议坚持使用CardLayout,如MadProgrammer在其回答中所述.

But! In your case, I recommend to stick with CardLayout as MadProgrammer stated in his answer.

这篇关于在netbeans中制作一个加载屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆