Example usage for java.awt MediaTracker LOADING

List of usage examples for java.awt MediaTracker LOADING

Introduction

In this page you can find the example usage for java.awt MediaTracker LOADING.

Prototype

int LOADING

To view the source code for java.awt MediaTracker LOADING.

Click Source Link

Usage

From source file:org.colombbus.tangara.Main.java

/**
 * Displays splash.png during the loading
 *///from  ww  w.  ja  v a2s  .c om
private static void displaySplashScreen() {
    URL url = SplashScreen.class.getResource("splash.png");
    splashScreenImage = new ImageIcon(url);
    // while the image is not on screen
    while (splashScreenImage.getImageLoadStatus() == MediaTracker.LOADING) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            LOG.debug("splash screen loading interrupted", e); //$NON-NLS-1$
        }
    }
    // should normally be run in the EDT, but launched at once in order to
    // display
    // the screen as soon as possible
    new SplashScreen(splashScreenImage, 3000);
}