java.lang.Objectjava.awt.SplashScreen
public final class SplashScreen
The splash screen can be created at application startup, before the Java Virtual Machine (JVM) starts. The splash screen is displayed as an undecorated window containing an image. You can use GIF, JPEG, and PNG files for the image. Animation (for GIF) and transparency (for GIF, PNG) are supported. The window is positioned at the center of the
screen (the position on multi-monitor systems
screen. It
is
not specified - it is platform and implementation dependent). The window is
closed automatically as soon as the first window is displayed by Swing/AWT (may be also closed manually using the Java API, see below).
There are two ways to show the native splash screen:
java -splash:filename.gif Test
Manifest-Version: 1.0 Main-Class: Test SplashScreen-Image: filename.gifThe command line interface has higher precedence over the manifest setting.
The SplashScreen class provides the API for controlling the splash screen. This class may be used to close the splash screen, change the splash screen image, get the image position/size and paint in the splash screen. It cannot be used to create the splash screen; you should use the command line or manifest file option for that.
This class cannot be instantiated. Only a single instance of this class can exist, and it may be obtained using the getSplashScreen() static method. In case the splash screen has not been created at application startup via the command line or manifest file option, the getSplashScreen method returns null.
Method Summary | |
---|---|
void |
close
() Hides the splash screen, closes the window, and releases all associated resources. |
![]() ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
URL |
getImageURL
() Returns the current splash screen image. |
Dimension |
getSize
() Returns the size of the splash screen window as a Dimension . |
static SplashScreen |
getSplashScreen
() Returns the SplashScreen object used for Java startup splash screen control. |
boolean |
isVisible
() Determines whether the splash screen is visible. |
void |
setImageURL
(
URL
imageURL) Changes the splash screen image. |
void |
update
() Updates the splash window with current contents of the overlay image. |
Methods inherited from class java.lang. Object |
---|
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
Method Detail |
---|
public static SplashScreen getSplashScreen()
public void setImageURL(URL imageURL) throws NullPointerException, IOException, IllegalStateException
public URL getImageURL() throws IllegalStateException
public Rectangle getBounds() throws IllegalStateException
You cannot control the size or position of the splash screen. The splash screen size is adjusted automatically when the image changes.
public Dimension getSize() throws IllegalStateException
You cannot control the size or position of the splash screen. The splash screen size is adjusted automatically when the image changes.
publicGraphics2D
GraphicscreateGraphics
getGraphics() throws IllegalStateException
public void update() throws IllegalStateException
public void close() throws IllegalStateException
public boolean isVisible()