简体   繁体   中英

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. 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?

to display a gif, which is my loading screen and then automatically terminate.

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.

You could use a javax.swing.Timer to call dispose on the frame to close it after...

See How to use Swing Timers for more details

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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