I want a JFrame to display a gif, which is my loading screen and then automatically terminate. I am OK with either terminating it after a particular time period or after it completes displaying the gif. Is there any way to do this?
我想要一个JFrame来显示一个gif,这是我的加载屏幕,然后自动终止。我可以在特定时间段之后或在完成显示gif之后终止它。有没有办法做到这一点?
2 个解决方案
#1
3
to display a gif, which is my loading screen and then automatically terminate.
显示一个gif,这是我的加载屏幕,然后自动终止。
Sounds like you might want a splash screen.
听起来你可能想要一个闪屏。
See the section in the Swing tutorial on How to Create a Splash Screen for more information and a working example.
有关更多信息和工作示例,请参阅Swing教程中有关如何创建启动画面的部分。
#2
1
You could use a javax.swing.Timer
to call dispose
on the frame to close it after...
您可以使用javax.swing.Timer在帧上调用dispose以在...后关闭它。
See How to use Swing Timers for more details
有关更多详细信息,请参见如何使用Swing Timers
#1
3
to display a gif, which is my loading screen and then automatically terminate.
显示一个gif,这是我的加载屏幕,然后自动终止。
Sounds like you might want a splash screen.
听起来你可能想要一个闪屏。
See the section in the Swing tutorial on How to Create a Splash Screen for more information and a working example.
有关更多信息和工作示例,请参阅Swing教程中有关如何创建启动画面的部分。
#2
1
You could use a javax.swing.Timer
to call dispose
on the frame to close it after...
您可以使用javax.swing.Timer在帧上调用dispose以在...后关闭它。
See How to use Swing Timers for more details
有关更多详细信息,请参见如何使用Swing Timers