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

Print this page




 202      *
 203      * @return URL for the current splash screen image file
 204      * @throws IllegalStateException if the splash screen has already been closed
 205      */
 206     public URL getImageURL() throws IllegalStateException {
 207         synchronized (SplashScreen.class) {
 208             checkVisible();
 209             if (imageURL == null) {
 210                 try {
 211                     String fileName = _getImageFileName(splashPtr);
 212                     String jarName = _getImageJarName(splashPtr);
 213                     if (fileName != null) {
 214                         if (jarName != null) {
 215                             imageURL = new URL("jar:"+(new File(jarName).toURL().toString())+"!/"+fileName);
 216                         } else {
 217                             imageURL = new File(fileName).toURL();
 218                         }
 219                     }
 220                 }
 221                 catch(java.net.MalformedURLException e) {
 222                     if (log.isLoggable(PlatformLogger.FINE)) {
 223                         log.fine("MalformedURLException caught in the getImageURL() method", e);
 224                     }
 225                 }
 226             }
 227             return imageURL;
 228         }
 229     }
 230 
 231     /**
 232      * Returns the bounds of the splash screen window as a {@link Rectangle}.
 233      * This may be useful if, for example, you want to replace the splash
 234      * screen with your window at the same location.
 235      * <p>
 236      * You cannot control the size or position of the splash screen.
 237      * The splash screen size is adjusted automatically when the image changes.
 238      * <p>
 239      * The image may contain transparent areas, and thus the reported bounds may
 240      * be larger than the visible splash screen image on the screen.
 241      *
 242      * @return a {@code Rectangle} containing the splash screen bounds




 202      *
 203      * @return URL for the current splash screen image file
 204      * @throws IllegalStateException if the splash screen has already been closed
 205      */
 206     public URL getImageURL() throws IllegalStateException {
 207         synchronized (SplashScreen.class) {
 208             checkVisible();
 209             if (imageURL == null) {
 210                 try {
 211                     String fileName = _getImageFileName(splashPtr);
 212                     String jarName = _getImageJarName(splashPtr);
 213                     if (fileName != null) {
 214                         if (jarName != null) {
 215                             imageURL = new URL("jar:"+(new File(jarName).toURL().toString())+"!/"+fileName);
 216                         } else {
 217                             imageURL = new File(fileName).toURL();
 218                         }
 219                     }
 220                 }
 221                 catch(java.net.MalformedURLException e) {
 222                     if (log.isLoggable(PlatformLogger.Level.FINE)) {
 223                         log.fine("MalformedURLException caught in the getImageURL() method", e);
 224                     }
 225                 }
 226             }
 227             return imageURL;
 228         }
 229     }
 230 
 231     /**
 232      * Returns the bounds of the splash screen window as a {@link Rectangle}.
 233      * This may be useful if, for example, you want to replace the splash
 234      * screen with your window at the same location.
 235      * <p>
 236      * You cannot control the size or position of the splash screen.
 237      * The splash screen size is adjusted automatically when the image changes.
 238      * <p>
 239      * The image may contain transparent areas, and thus the reported bounds may
 240      * be larger than the visible splash screen image on the screen.
 241      *
 242      * @return a {@code Rectangle} containing the splash screen bounds