src/share/classes/java/awt/SplashScreen.java

Print this page




 102 
 103     /**
 104      * Returns the {@code SplashScreen} object used for
 105      * Java startup splash screen control on systems that support display.
 106      *
 107      * @throws UnsupportedOperationException if the splash screen feature is not
 108      *         supported by the current toolkit
 109      * @throws HeadlessException if {@code GraphicsEnvironment.isHeadless()}
 110      *         returns true
 111      * @return the {@link SplashScreen} instance, or <code>null</code> if there is
 112      *         none or it has already been closed
 113      */
 114     public static  SplashScreen getSplashScreen() {
 115         synchronized (SplashScreen.class) {
 116             if (GraphicsEnvironment.isHeadless()) {
 117                 throw new HeadlessException();
 118             }
 119             // SplashScreen class is now a singleton
 120             if (!wasClosed && theInstance == null) {
 121                 java.security.AccessController.doPrivileged(
 122                         new sun.security.action.LoadLibraryAction("splashscreen"));





 123                 long ptr = _getInstance();
 124                 if (ptr != 0 && _isVisible(ptr)) {
 125                     theInstance = new SplashScreen(ptr);
 126                 }
 127             }
 128             return theInstance;
 129         }
 130     }
 131 
 132     /**
 133      * Changes the splash screen image. The new image is loaded from the
 134      * specified URL; GIF, JPEG and PNG image formats are supported.
 135      * The method returns after the image has finished loading and the window
 136      * has been updated.
 137      * The splash screen window is resized according to the size of
 138      * the image and is centered on the screen.
 139      *
 140      * @param imageURL the non-<code>null</code> URL for the new
 141      *        splash screen image
 142      * @throws NullPointerException if {@code imageURL} is <code>null</code>




 102 
 103     /**
 104      * Returns the {@code SplashScreen} object used for
 105      * Java startup splash screen control on systems that support display.
 106      *
 107      * @throws UnsupportedOperationException if the splash screen feature is not
 108      *         supported by the current toolkit
 109      * @throws HeadlessException if {@code GraphicsEnvironment.isHeadless()}
 110      *         returns true
 111      * @return the {@link SplashScreen} instance, or <code>null</code> if there is
 112      *         none or it has already been closed
 113      */
 114     public static  SplashScreen getSplashScreen() {
 115         synchronized (SplashScreen.class) {
 116             if (GraphicsEnvironment.isHeadless()) {
 117                 throw new HeadlessException();
 118             }
 119             // SplashScreen class is now a singleton
 120             if (!wasClosed && theInstance == null) {
 121                 java.security.AccessController.doPrivileged(
 122                     new java.security.PrivilegedAction<Void>() {
 123                         public Void run() {
 124                             System.loadLibrary("splashscreen");
 125                             return null;
 126                         }
 127                     });
 128                 long ptr = _getInstance();
 129                 if (ptr != 0 && _isVisible(ptr)) {
 130                     theInstance = new SplashScreen(ptr);
 131                 }
 132             }
 133             return theInstance;
 134         }
 135     }
 136 
 137     /**
 138      * Changes the splash screen image. The new image is loaded from the
 139      * specified URL; GIF, JPEG and PNG image formats are supported.
 140      * The method returns after the image has finished loading and the window
 141      * has been updated.
 142      * The splash screen window is resized according to the size of
 143      * the image and is centered on the screen.
 144      *
 145      * @param imageURL the non-<code>null</code> URL for the new
 146      *        splash screen image
 147      * @throws NullPointerException if {@code imageURL} is <code>null</code>