问题
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