Search in sources :

Example 1 with SplashWindow

use of apps.SplashWindow in project JMRI by JMRI.

the class Apps3 method splash.

protected static void splash(boolean show, boolean debug) {
    if (debugListener == null && debug) {
        // set a global listener for debug options
        debugFired = false;
        debugListener = new AWTEventListener() {

            @Override
            @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "debugmsg write is semi-global")
            public void eventDispatched(AWTEvent e) {
                if (!debugFired) {
                    /*We set the debugmsg flag on the first instance of the user pressing any button
                         and the if the debugFired hasn't been set, this allows us to ensure that we don't
                         miss the user pressing F8, while we are checking*/
                    debugmsg = true;
                    if (e.getID() == KeyEvent.KEY_PRESSED && e instanceof KeyEvent && ((KeyEvent) e).getKeyCode() == 119) {
                        startupDebug();
                    } else {
                        debugmsg = false;
                    }
                }
            }
        };
        Toolkit.getDefaultToolkit().addAWTEventListener(debugListener, AWTEvent.KEY_EVENT_MASK);
    }
    // bring up splash window for startup
    if (sp == null) {
        sp = new SplashWindow((debug) ? splashDebugMsg() : null);
    }
    sp.setVisible(show);
    if (!show) {
        sp.dispose();
        Toolkit.getDefaultToolkit().removeAWTEventListener(debugListener);
        debugListener = null;
        sp = null;
    }
}
Also used : KeyEvent(java.awt.event.KeyEvent) AWTEventListener(java.awt.event.AWTEventListener) SplashWindow(apps.SplashWindow) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) AWTEvent(java.awt.AWTEvent)

Aggregations

SplashWindow (apps.SplashWindow)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 AWTEvent (java.awt.AWTEvent)1 AWTEventListener (java.awt.event.AWTEventListener)1 KeyEvent (java.awt.event.KeyEvent)1