Title:
- *Description:
- *Copyright: Copyright (c) 2003
- *Company:
- * @author not attributable - * @version 1.0 - */ - -class SplashScreen extends Window { - - private final Image splashImage; - private boolean paintCalled = false; - - - private SplashScreen(Frame owner) { - super(owner); - URL imageURL = SplashScreen.class.getResource("/images/splash.png"); - splashImage = Toolkit.getDefaultToolkit().createImage(imageURL); - - // Load the image - MediaTracker mt = new MediaTracker(this); - mt.addImage(splashImage, 0); - try { - mt.waitForID(0); - } catch (InterruptedException ignored) { - } - - // Center the window on the screen. - int imgWidth = splashImage.getWidth(this); - int imgHeight = splashImage.getHeight(this); - - setSize(imgWidth, imgHeight); - setLocationRelativeTo(null); - - /* Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize(); - setLocation( - (screenDim.width - imgWidth) / 2, - (screenDim.height - imgHeight) / 2 - ); - */ - - } - - /** - * Updates the display area of the window. - */ - @Override - public void update(Graphics g) { - // Note: Since the paint method is going to draw an - // image that covers the complete area of the component we - // do not fill the component with its background color - // here. This avoids flickering. - - g.setColor(getForeground()); - paint(g); - } - - /** - * Paints the image on the window. - */ - - @Override - public void paint(Graphics g) { - g.drawImage(splashImage, 0, 0, this); - - // Notify method splash that the window - // has been painted. - if (!paintCalled) { - paintCalled = true; - synchronized (this) { - notifyAll(); - } - } - } - - /** - * Constructs and displays a SplashWindow.- * This method is useful for startup splashs. - * Dispose the returned frame to get rid of the splash window.
- * - * @return Returns the frame that owns the SplashWindow. - */ - - public static Frame splash() { - Frame f = new Frame(); - SplashScreen w = new SplashScreen(f); - - // Show the window. - w.setVisible(true); - w.toFront(); - - // Note: To make sure the user gets a chance to see the - // splash window we wait until its paint method has been - // called at least once by the AWT event dispatcher thread. - - // sebwills adds: However, just in case the paint method never gets called - // (e.g. if the splashscreen is completely obscured by an 'always on top' - // window of some other application), we time-out after 5 seconds. - if (!EventQueue.isDispatchThread()) { - synchronized (w) { - if (!w.paintCalled) { - try { - w.wait(5000); - } catch (InterruptedException ignored) { - } - } - } - } - return f; - } -} diff --git a/src/main/java/net/sf/jabref/gui/splash/SplashScreenLifecycle.java b/src/main/java/net/sf/jabref/gui/splash/SplashScreenLifecycle.java deleted file mode 100644 index 96b5eedcb28..00000000000 --- a/src/main/java/net/sf/jabref/gui/splash/SplashScreenLifecycle.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.sf.jabref.gui.splash; - -import java.awt.Frame; - -public class SplashScreenLifecycle { - - private Frame splashScreen; - - public void show() { - splashScreen = SplashScreen.splash(); - } - - public void hide() { - if (splashScreen != null) { - splashScreen.dispose(); - splashScreen = null; - } - } -} diff --git a/src/main/resources/images/splash.png b/src/main/resources/images/splash.png deleted file mode 100644 index 8df18f2c849..00000000000 Binary files a/src/main/resources/images/splash.png and /dev/null differ