在netbeans中制作一个加载屏幕 [英] Making a loading screen in 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?
推荐答案
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屋!