简体   繁体   English

在特定时间后如何终止JFrame?

[英]How to terminate a JFrame after a specific amount of time?

I want a JFrame to display a gif, which is my loading screen and then automatically terminate. 我希望JFrame显示gif,这是我的加载屏幕,然后自动终止。 I am OK with either terminating it after a particular time period or after it completes displaying the gif. 我可以在特定时间段后或在显示gif后终止它。 Is there any way to do this? 有什么办法吗?

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教程中有关如何创建启动画面的部分。

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计时器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM