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;
}
}
Aggregations