示例#1
0
  public static void preferences() {
    if (pref == null) {
      JFrame parent = null;
      if (window.isVisible()) {
        parent = window;
      }
      PrefPanel panel;
      if (prefclass == null) {
        panel = new PrefPanel();
      } else {
        panel = (PrefPanel) newInstance(prefclass);
      }
      panel.setParentFrame(parent);
      int result =
          JOptionPane.showConfirmDialog(
              parent,
              panel,
              "Preferences",
              JOptionPane.OK_CANCEL_OPTION,
              JOptionPane.PLAIN_MESSAGE,
              new ImageIcon());
      if (result == JOptionPane.OK_OPTION) {
        panel.savePreferences();
      } else {

      }
    } else {
      pref.setVisible(true);
    }
  }
示例#2
0
 public static void closeWindow(AbstractWindow window) {
   if (window.getJustHide()) {
     window.setVisible(false);
   } else {
     if (window.onClose() && instance.onClose(window)) {
       window.setVisible(false);
       removeWindow(window);
     }
   }
 }
示例#3
0
 public static void closeActiveWindow() {
   for (int i = 0; i < windows.size(); i++) {
     try {
       AbstractWindow window = (AbstractWindow) windows.get(i);
       if (window != null && window.isActive()) {
         closeWindow(window);
       }
     } catch (Exception e) {
       logger.warning("Cannot close window: " + e.getMessage());
     }
   }
 }
示例#4
0
 public void cancelUpdate(String window_name) {
   try {
     saveUpdateSettings();
     if (!cmd.getQuiet()) {
       if (window_name == null) {
         window = new MainWindow();
       } else {
         window = (AbstractWindow) newInstance(window_name);
       }
       addWindow(window);
       window.setVisible(window.getWindowSettings().getVisible());
       window.postLoad();
     }
   } catch (Exception ex) {
     ex.printStackTrace();
     logger.severe("Could not start application: " + ex.getMessage());
   }
 }
示例#5
0
 public static void about() {
   Component parent = null;
   if (window.isVisible()) {
     parent = window;
   }
   AboutPanel panel;
   if (aboutclass == null) {
     panel = new AboutPanel();
   } else {
     panel = (AboutPanel) newInstance(aboutclass);
   }
   JOptionPane.showMessageDialog(
       parent, panel, "About", JOptionPane.INFORMATION_MESSAGE, AboutImage());
 }