| |
|
| java.lang.Object java.awt.SplashScreen
SplashScreen | final public class SplashScreen (Code) | | 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 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:
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
SplashScreen.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 .
author: Oleg Semenov since: 1.6 |
Method Summary | |
public void | close() Hides the splash screen, closes the window, and releases all associated
resources. | public Graphics2D | createGraphics() Creates a graphics context (as a
Graphics2D object) for the splash
screen overlay image, which allows you to draw over the splash screen.
Note that you do not draw on the main image but on the image that is
displayed over the main image using alpha blending. | public Rectangle | getBounds() Returns the bounds of the splash screen window as a
Rectangle . | public URL | getImageURL() Returns the current splash screen image. | public Dimension | getSize() Returns the size of the splash screen window as a
Dimension . | public static SplashScreen | getSplashScreen() Returns the
SplashScreen object used for
Java startup splash screen control. | public boolean | isVisible() Determines whether the splash screen is visible. | public void | setImageURL(URL imageURL) Changes the splash screen image. | public void | update() Updates the splash window with current contents of the overlay image. |
SplashScreen | SplashScreen(long ptr)(Code) | | |
createGraphics | public Graphics2D createGraphics() throws IllegalStateException(Code) | | Creates a graphics context (as a
Graphics2D object) for the splash
screen overlay image, which allows you to draw over the splash screen.
Note that you do not draw on the main image but on the image that is
displayed over the main image using alpha blending. Also note that drawing
on the overlay image does not necessarily update the contents of splash
screen window. You should call
update() on the
SplashScreen when you want the splash screen to be
updated immediately.
graphics context for the splash screen overlay surface throws: IllegalStateException - if the splash screen has already been closed |
getBounds | public Rectangle getBounds() throws IllegalStateException(Code) | | Returns the bounds of the splash screen window as a
Rectangle .
This may be useful if, for example, you want to replace the splash
screen with your window at the same location.
You cannot control the size or position of the splash screen.
The splash screen size is adjusted automatically when the image changes.
a Rectangle containing the splash screen bounds throws: IllegalStateException - if the splash screen has already been closed |
getSize | public Dimension getSize() throws IllegalStateException(Code) | | Returns the size of the splash screen window as a
Dimension .
This may be useful if, for example,
you want to draw on the splash screen overlay surface.
You cannot control the size or position of the splash screen.
The splash screen size is adjusted automatically when the image changes.
a Dimension object indicating the splash screen size throws: IllegalStateException - if the splash screen has already been closed |
getSplashScreen | public static SplashScreen getSplashScreen()(Code) | | Returns the
SplashScreen object used for
Java startup splash screen control.
throws: UnsupportedOperationException - if the splash screen feature is notsupported by the current toolkit throws: HeadlessException - if GraphicsEnvironment.isHeadless() returns true the SplashScreen instance, or null if there isnone or it has already been closed |
isVisible | public boolean isVisible()(Code) | | Determines whether the splash screen is visible. The splash screen may
be hidden using
SplashScreen.close() , it is also hidden automatically when
the first AWT/Swing window is made visible.
true if the splash screen is visible (has not been closed yet),false otherwise |
setImageURL | public void setImageURL(URL imageURL) throws NullPointerException, IOException, IllegalStateException(Code) | | Changes the splash screen image. The new image is loaded from the
specified URL; GIF, JPEG and PNG image formats are supported.
The method returns after the image has finished loading and the window
has been updated.
The splash screen window is resized according to the size of
the image and is centered on the screen.
Parameters: imageURL - the non-null URL for the newsplash screen image throws: NullPointerException - if imageURL is null throws: IOException - if there was an error while loading the image throws: IllegalStateException - if the splash screen has already beenclosed |
update | public void update() throws IllegalStateException(Code) | | Updates the splash window with current contents of the overlay image.
throws: IllegalStateException - if the overlay image does not exist; for example, if createGraphics has never been called,or if the splash screen has already been closed |
|
|
|