Пример #1
0
  protected static void splash(boolean show, boolean debug) {
    Log4JUtil.initLog4J();
    if (debugListener == null && debug) {
      // set a global listener for debug options
      debugFired = false;
      Toolkit.getDefaultToolkit()
          .addAWTEventListener(
              debugListener =
                  new AWTEventListener() {
                    @Override
                    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) {
                          KeyEvent ky = (KeyEvent) e;
                          if (ky.getKeyCode() == 119) {
                            startupDebug();
                          } else {
                            debugmsg = false;
                          }
                        } else {
                          debugmsg = false;
                        }
                      }
                    }
                  },
              AWTEvent.KEY_EVENT_MASK);
    }

    // bring up splash window for startup
    if (sp == null) {
      if (debug) {
        sp = new SplashWindow(splashDebugMsg());
      } else {
        sp = new SplashWindow();
      }
    }
    sp.setVisible(show);
    if (!show) {
      sp.dispose();
      Toolkit.getDefaultToolkit().removeAWTEventListener(debugListener);
      debugListener = null;
      sp = null;
    }
  }
Пример #2
0
 /** Hide (and dispose) the splash window */
 public void disposeSplashWindow() {
   if (splashWindow != null) {
     splashWindow.dispose();
     splashWindow = null;
   }
 }