Loading Spalsh Screen before application launching

2019-04-02 18:28发布

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

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

2条回答
2楼-- · 2019-04-02 18:39

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').

查看更多
欢心
3楼-- · 2019-04-02 18:55

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.

查看更多
登录 后发表回答