Loading Spalsh Screen before application launching

我怕爱的太早我们不能终老 提交于 2020-01-01 07:23:32

问题


How can I do to create a loading jframe without title bar like Eclipse in the image...

I used setUndecorate() to remove the title bar and a thread to wait 3 seconds then open the main window but it wouldn't work ... I'm not thinking to use a progressbar...

How can I do??

Thanks in advance.

Best rgards,

Ali


回答1:


Another way could be what you already thought of: display an undecorated JFrame when the application starts, then instead of just waiting for a few seconds (you could do that as well, if you want users to read some info) just keep initializing the application. When initialization is finished, close the "splash screen" (undecorated JFrame) and open the actual application JFrame.

This would enable you to display dynamic information (like a progress bar if you later want to, some text etc.). If all you need is a static splash screen, go for Andrew's advice and use the built in splash screen functionality.




回答2:


See the SplashScreen class.

It includes the createGraphics() method that returns a Graphics2D object that can be written to. You would need to draw the progress bar to the graphics object.


Java Web Start also offers splash screen functionality, configured in the launch file. But the graphics object of the JWS splash screen are not available to the app. (so no 'progress bar').



来源:https://stackoverflow.com/questions/5360854/loading-spalsh-screen-before-application-launching

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!