This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.awt
class SplashScreen

java.lang.Object extended by java.awt.SplashScreen

Most common way to construct:

SplashScreen splash = SplashScreen.getSplashScreen();

Based on 39 examples


public final class SplashScreen
extends Object

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 {@code 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 {@link #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

          Hides the splash screen, closes the window, and releases all associated resources.
 Graphics2D

          Creates a graphics context (as a java.awt.Graphics2D object) for the splash screen overlay image, which allows you to draw over the splash screen.
 Rectangle

          Returns the bounds of the splash screen window as a java.awt.Rectangle.
 URL

          Returns the current splash screen image.
 Dimension

          Returns the size of the splash screen window as a java.awt.Dimension.
static SplashScreen

          Returns the object used for Java startup splash screen control.
 boolean

          Determines whether the splash screen is visible.
 void
setImageURL(URL imageURL)

          Changes the splash screen image.
 void

          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

close

public synchronized void close()
                        throws IllegalStateException
Hides the splash screen, closes the window, and releases all associated resources.

Throws:
IllegalStateException - if the splash screen has already been closed

createGraphics

public Graphics2D createGraphics()
                          throws IllegalStateException
Creates a graphics context (as a {@link 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 {@code update()} on the SplashScreen when you want the splash screen to be updated immediately.

Returns:
graphics context for the splash screen overlay surface
Throws:
IllegalStateException - if the splash screen has already been closed

getBounds

public Rectangle getBounds()
                    throws IllegalStateException
Returns the bounds of the splash screen window as a {@link 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.

Returns:
a {@code Rectangle} containing the splash screen bounds
Throws:
IllegalStateException - if the splash screen has already been closed

getImageURL

public synchronized URL getImageURL()
                             throws IllegalStateException
Returns the current splash screen image.

Returns:
URL for the current splash screen image file
Throws:
IllegalStateException - if the splash screen has already been closed

getSize

public Dimension getSize()
                  throws IllegalStateException
Returns the size of the splash screen window as a {@link 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.

Returns:
a {@link Dimension} object indicating the splash screen size
Throws:
IllegalStateException - if the splash screen has already been closed

getSplashScreen

public static synchronized SplashScreen getSplashScreen()
Returns the {@code SplashScreen} object used for Java startup splash screen control.

Returns:
the {@link SplashScreen} instance, or null if there is none or it has already been closed

isVisible

public boolean isVisible()
Determines whether the splash screen is visible. The splash screen may be hidden using {@link #close()}, it is also hidden automatically when the first AWT/Swing window is made visible.

Returns:
true if the splash screen is visible (has not been closed yet), false otherwise

setImageURL

public void setImageURL(URL imageURL)
                 throws NullPointerException,
                        IOException,
                        IllegalStateException
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 new splash screen image
Throws:
NullPointerException - if {@code imageURL} is null
IOException - if there was an error while loading the image
IllegalStateException - if the splash screen has already been closed

update

public void update()
            throws IllegalStateException
Updates the splash window with current contents of the overlay image.

Throws:
IllegalStateException - if the overlay image does not exist; for example, if {@code createGraphics} has never been called, or if the splash screen has already been closed


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.