Exemple #1
0
  public boolean restartApplicationWithScript() {
    String command = null;
    try {
      if (Spark.isWindows()) {
        String sparkExe =
            getCommandPath() + File.separator + Default.getString(Default.SHORT_NAME) + ".exe";
        if (!new File(sparkExe).exists()) {
          Log.warning("Client EXE file does not exist");
          return false;
        }
        String starterExe = getCommandPath() + File.separator + "starter.exe";
        if (!new File(starterExe).exists()) {
          Log.warning("Starter EXE file does not exist");
          return false;
        }
        command = starterExe + " \"" + sparkExe + "\"";
      } else if (Spark.isLinux()) {
        command = getCommandPath() + File.separator + Default.getString(Default.SHORT_NAME);
        if (!new File(command).exists()) {
          Log.warning("Client startup script does not exist");
          return false;
        }
      } else if (Spark.isMac()) {
        command = "open -a " + Default.getString(Default.SHORT_NAME);
      }

      Runtime.getRuntime().exec(command);
      System.exit(0);
      return true;
    } catch (IOException e) {
      Log.error("Error trying to restart application with script", e);
      return false;
    }
  }
Exemple #2
0
 /** Displays the About Box for Spark. */
 private static void showAboutBox() {
   JOptionPane.showMessageDialog(
       SparkManager.getMainWindow(),
       Default.getString(Default.APPLICATION_NAME) + " " + JiveInfo.getVersion(),
       Res.getString("title.about"),
       JOptionPane.INFORMATION_MESSAGE,
       SparkRes.getImageIcon(SparkRes.MAIN_IMAGE));
 }
Exemple #3
0
  /**
   * Returns the singleton instance of <CODE>MainWindow</CODE>, creating it if necessary.
   *
   * <p>
   *
   * @return the singleton instance of <Code>MainWindow</CODE>
   */
  public static MainWindow getInstance() {
    // Synchronize on LOCK to ensure that we don't end up creating
    // two singletons.

    synchronized (LOCK) {
      if (null == singleton) {
        MainWindow controller =
            new MainWindow(
                Default.getString(Default.APPLICATION_NAME), SparkManager.getApplicationImage());
        singleton = controller;
      }
    }
    return singleton;
  }
Exemple #4
0
  /**
   * Prepares Spark for shutting down by first calling all {@link MainWindowListener}s and setting
   * the Agent to be offline.
   */
  public void shutdown() {
    final XMPPConnection con = SparkManager.getConnection();

    if (con.isConnected()) {
      // Send disconnect.
      con.disconnect();
    }

    // Notify all MainWindowListeners
    try {
      fireWindowShutdown();
    } catch (Exception ex) {
      Log.error(ex);
    }
    // Close application.
    if (!Default.getBoolean("DISABLE_EXIT")) System.exit(1);
  }
Exemple #5
0
  /** Setup the Main Toolbar with File, Tools and Help. */
  private void buildMenu() {

    // setup file menu
    final JMenuItem exitMenuItem = new JMenuItem();

    // Setup ResourceUtils
    ResourceUtils.resButton(connectMenu, "&" + Default.getString(Default.APPLICATION_NAME));
    ResourceUtils.resButton(contactsMenu, Res.getString("menuitem.contacts"));
    ResourceUtils.resButton(actionsMenu, Res.getString("menuitem.actions"));
    ResourceUtils.resButton(exitMenuItem, Res.getString("menuitem.exit"));
    ResourceUtils.resButton(pluginsMenu, Res.getString("menuitem.plugins"));

    exitMenuItem.setIcon(null);

    mainWindowBar.add(connectMenu);
    mainWindowBar.add(contactsMenu);
    mainWindowBar.add(actionsMenu);
    // mainWindowBar.add(pluginsMenu);
    mainWindowBar.add(helpMenu);

    preferenceMenuItem = new JMenuItem(SparkRes.getImageIcon(SparkRes.PREFERENCES_IMAGE));
    preferenceMenuItem.setText(Res.getString("title.spark.preferences"));
    preferenceMenuItem.addActionListener(this);
    connectMenu.add(preferenceMenuItem);

    alwaysOnTopItem = new JCheckBoxMenuItem();
    ResourceUtils.resButton(alwaysOnTopItem, Res.getString("menuitem.always.on.top"));
    alwaysOnTopItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            if (alwaysOnTopItem.isSelected()) {
              SettingsManager.getLocalPreferences().setMainWindowAlwaysOnTop(true);
              MainWindow.getInstance().setAlwaysOnTop(true);
            } else {
              SettingsManager.getLocalPreferences().setMainWindowAlwaysOnTop(false);
              MainWindow.getInstance().setAlwaysOnTop(false);
            }
          }
        });

    if (SettingsManager.getLocalPreferences().isMainWindowAlwaysOnTop()) {
      alwaysOnTopItem.setSelected(true);
      this.setAlwaysOnTop(true);
    }
    connectMenu.add(alwaysOnTopItem);

    if (!Default.getBoolean("DISABLE_EXIT")) connectMenu.addSeparator();

    // EventQueue.invokeLater(new Runnable() {
    //	public void run() {

    JMenuItem logoutMenuItem = new JMenuItem();
    ResourceUtils.resButton(logoutMenuItem, Res.getString("menuitem.logout.no.status"));
    logoutMenuItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            logout(false);
          }
        });

    JMenuItem logoutWithStatus = new JMenuItem();
    ResourceUtils.resButton(logoutWithStatus, Res.getString("menuitem.logout.with.status"));
    logoutWithStatus.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            logout(true);
          }
        });

    if ((Spark.isWindows() || Spark.isLinux() || Spark.isMac())
        && !Default.getBoolean("DISABLE_EXIT")) {
      connectMenu.add(logoutMenuItem);
      connectMenu.add(logoutWithStatus);
      connectMenu.addSeparator();
    }

    if (!Default.getBoolean("DISABLE_EXIT")) {
      connectMenu.add(exitMenuItem);
    }

    JMenuItem updateMenu = new JMenuItem("", SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16));
    ResourceUtils.resButton(updateMenu, Res.getString("menuitem.check.for.updates"));
    updateMenu.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            checkForUpdates(true);
          }
        });

    // Add Error Dialog Viewer
    final Action viewErrors =
        new AbstractAction() {
          private static final long serialVersionUID = -420926784631340112L;

          public void actionPerformed(ActionEvent e) {
            File logDir = new File(Spark.getLogDirectory(), "errors.log");
            if (!logDir.exists()) {
              JOptionPane.showMessageDialog(
                  SparkManager.getMainWindow(),
                  "No error logs found.",
                  "Error Log",
                  JOptionPane.INFORMATION_MESSAGE);
            } else {
              showErrorLog();
            }
          }
        };

    viewErrors.putValue(Action.NAME, Res.getString("menuitem.view.logs"));

    final Action viewHelpGuideAction =
        new AbstractAction() {

          final String url = Default.getString(Default.HELP_USER_GUIDE);
          private static final long serialVersionUID = 2680369963282231348L;

          public void actionPerformed(ActionEvent actionEvent) {
            try {

              BrowserLauncher.openURL(url);
            } catch (Exception e) {
              Log.error("Unable to load online help.", e);
            }
          }
        };

    if (!Default.getBoolean("HELP_USER_GUIDE_DISABLED")) {
      viewHelpGuideAction.putValue(Action.NAME, Res.getString("menuitem.user.guide"));
      viewHelpGuideAction.putValue(
          Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_QUESTION));
      helpMenu.add(viewHelpGuideAction);
    }
    if (!Default.getBoolean("HELP_FORUM_DISABLED")) {
      helpMenu.add(sparkforumItem);
    }

    // Build Help Menu
    if (!Default.getBoolean(Default.DISABLE_UPDATES)) {
      helpMenu.add(updateMenu);
    }
    helpMenu.addSeparator();
    helpMenu.add(viewErrors);
    helpMenu.add(menuAbout);

    // ResourceUtils - Adds mnemonics
    ResourceUtils.resButton(preferenceMenuItem, Res.getString("menuitem.preferences"));
    ResourceUtils.resButton(helpMenu, Res.getString("menuitem.help"));
    ResourceUtils.resButton(menuAbout, Res.getString("menuitem.about"));

    if (Default.getString("HELP_FORUM_TEXT").length() > 0) {
      ResourceUtils.resButton(sparkforumItem, Default.getString("HELP_FORUM_TEXT"));
    } else {
      ResourceUtils.resButton(sparkforumItem, Res.getString("menuitem.online.help"));
    }
    // Register shutdown with the exit menu.
    exitMenuItem.addActionListener(
        new AbstractAction() {
          private static final long serialVersionUID = -2301236575241532698L;

          public void actionPerformed(ActionEvent e) {
            shutdown();
          }
        });

    sparkforumItem.addActionListener(
        new AbstractAction() {
          private static final long serialVersionUID = -1423433460333010339L;

          final String url = Default.getString("HELP_FORUM");

          public void actionPerformed(ActionEvent e) {
            try {
              BrowserLauncher.openURL(url);
            } catch (Exception browserException) {
              Log.error("Error launching browser:", browserException);
            }
          }
        });

    // Show About Box
    menuAbout.addActionListener(
        new AbstractAction() {
          private static final long serialVersionUID = -7173666373051354502L;

          public void actionPerformed(ActionEvent e) {
            showAboutBox();
          }
        });

    if (!Default.getBoolean("DISABLE_UPDATES")) {
      // Execute spark update checker after one minute.
      final TimerTask task =
          new SwingTimerTask() {
            public void doRun() {
              checkForUpdates(false);
            }
          };

      TaskEngine.getInstance().schedule(task, 60000);
    }

    if (SettingsManager.getLocalPreferences().isDebuggerEnabled()) {
      JMenuItem rawPackets = new JMenuItem(SparkRes.getImageIcon(SparkRes.TRAY_IMAGE));
      rawPackets.setText("Send Packets");
      rawPackets.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              new RawPacketSender();
            }
          });

      connectMenu.add(rawPackets, 2);
    }
  }
  @Override
  public void initialize() {

    if (SystemTray.isSupported()) {

      JMenuItem openMenu = new JMenuItem(Res.getString("menuitem.open"));
      JMenuItem minimizeMenu = new JMenuItem(Res.getString("menuitem.hide"));
      JMenuItem exitMenu = new JMenuItem(Res.getString("menuitem.exit"));
      statusMenu = new JMenu(Res.getString("menuitem.status"));
      JMenuItem logoutMenu = new JMenuItem(Res.getString("menuitem.logout.no.status"));

      SystemTray tray = SystemTray.getSystemTray();
      SparkManager.getNativeManager().addNativeHandler(this);
      ChatManager.getInstance().addChatMessageHandler(chatMessageHandler);
      // XEP-0085 suport (replaces the obsolete XEP-0022)
      org.jivesoftware.smack.chat.ChatManager.getInstanceFor(SparkManager.getConnection())
          .addChatListener(this);

      if (Spark.isLinux()) {
        newMessageIcon = SparkRes.getImageIcon(SparkRes.MESSAGE_NEW_TRAY_LINUX);
        typingIcon = SparkRes.getImageIcon(SparkRes.TYPING_TRAY_LINUX);
      } else {
        newMessageIcon = SparkRes.getImageIcon(SparkRes.MESSAGE_NEW_TRAY);
        typingIcon = SparkRes.getImageIcon(SparkRes.TYPING_TRAY);
      }

      availableIcon = Default.getImageIcon(Default.TRAY_IMAGE);
      if (Spark.isLinux()) {
        if (availableIcon == null) {
          availableIcon = SparkRes.getImageIcon(SparkRes.TRAY_IMAGE_LINUX);
          Log.error(availableIcon.toString());
        }
        awayIcon = SparkRes.getImageIcon(SparkRes.TRAY_AWAY_LINUX);
        dndIcon = SparkRes.getImageIcon(SparkRes.TRAY_DND_LINUX);
        offlineIcon = SparkRes.getImageIcon(SparkRes.TRAY_OFFLINE_LINUX);
        connectingIcon = SparkRes.getImageIcon(SparkRes.TRAY_CONNECTING_LINUX);
      } else {
        if (availableIcon == null) {
          availableIcon = SparkRes.getImageIcon(SparkRes.TRAY_IMAGE);
        }
        awayIcon = SparkRes.getImageIcon(SparkRes.TRAY_AWAY);
        dndIcon = SparkRes.getImageIcon(SparkRes.TRAY_DND);
        offlineIcon = SparkRes.getImageIcon(SparkRes.TRAY_OFFLINE);
        connectingIcon = SparkRes.getImageIcon(SparkRes.TRAY_CONNECTING);
      }

      popupMenu.add(openMenu);
      openMenu.addActionListener(
          new AbstractAction() {

            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent event) {
              SparkManager.getMainWindow().setVisible(true);
              SparkManager.getMainWindow().toFront();
            }
          });
      popupMenu.add(minimizeMenu);
      minimizeMenu.addActionListener(
          new AbstractAction() {
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent event) {
              SparkManager.getMainWindow().setVisible(false);
            }
          });
      popupMenu.addSeparator();
      addStatusMessages();
      popupMenu.add(statusMenu);
      statusMenu.addActionListener(
          new AbstractAction() {
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent event) {}
          });

      if (Spark.isWindows()) {
        if (!Default.getBoolean("DISABLE_EXIT")) popupMenu.add(logoutMenu);

        logoutMenu.addActionListener(
            new AbstractAction() {
              private static final long serialVersionUID = 1L;

              @Override
              public void actionPerformed(ActionEvent e) {
                SparkManager.getMainWindow().logout(false);
              }
            });
      }
      // Exit Menu
      exitMenu.addActionListener(
          new AbstractAction() {
            private static final long serialVersionUID = 1L;

            @Override
            public void actionPerformed(ActionEvent e) {
              SparkManager.getMainWindow().shutdown();
            }
          });
      if (!Default.getBoolean("DISABLE_EXIT")) popupMenu.add(exitMenu);

      /** If connection closed set offline tray image */
      SparkManager.getConnection()
          .addConnectionListener(
              new ConnectionListener() {

                @Override
                public void connected(XMPPConnection xmppConnection) {
                  trayIcon.setImage(availableIcon.getImage());
                }

                @Override
                public void authenticated(XMPPConnection xmppConnection, boolean b) {
                  trayIcon.setImage(availableIcon.getImage());
                }

                @Override
                public void connectionClosed() {
                  trayIcon.setImage(offlineIcon.getImage());
                }

                @Override
                public void connectionClosedOnError(Exception arg0) {
                  trayIcon.setImage(offlineIcon.getImage());
                }

                @Override
                public void reconnectingIn(int arg0) {
                  trayIcon.setImage(connectingIcon.getImage());
                }

                @Override
                public void reconnectionSuccessful() {
                  trayIcon.setImage(availableIcon.getImage());
                }

                @Override
                public void reconnectionFailed(Exception arg0) {
                  trayIcon.setImage(offlineIcon.getImage());
                }
              });

      SparkManager.getSessionManager()
          .addPresenceListener(
              presence -> {
                if (presence.getMode() == Presence.Mode.available) {
                  trayIcon.setImage(availableIcon.getImage());
                } else if (presence.getMode() == Presence.Mode.away
                    || presence.getMode() == Presence.Mode.xa) {
                  trayIcon.setImage(awayIcon.getImage());
                } else if (presence.getMode() == Presence.Mode.dnd) {
                  trayIcon.setImage(dndIcon.getImage());
                } else {
                  trayIcon.setImage(availableIcon.getImage());
                }
              });

      try {

        trayIcon =
            new TrayIcon(
                availableIcon.getImage(), Default.getString(Default.APPLICATION_NAME), null);
        trayIcon.setImageAutoSize(true);

        trayIcon.addMouseListener(
            new MouseListener() {

              @Override
              public void mouseClicked(MouseEvent event) {
                // if we are using double click on tray icon
                if ((!pref.isUsingSingleTrayClick()
                        && event.getButton() == MouseEvent.BUTTON1
                        && event.getClickCount() % 2 == 0)
                    ||
                    // if we using single click on tray icon
                    (pref.isUsingSingleTrayClick()
                        && event.getButton() == MouseEvent.BUTTON1
                        && event.getClickCount() == 1)) {

                  // bring the mainwindow to front
                  if ((SparkManager.getMainWindow().isVisible())
                      && (SparkManager.getMainWindow().getState() == java.awt.Frame.NORMAL)) {
                    SparkManager.getMainWindow().setVisible(false);
                  } else {
                    SparkManager.getMainWindow().setVisible(true);
                    SparkManager.getMainWindow().setState(java.awt.Frame.NORMAL);
                    SparkManager.getMainWindow().toFront();
                  }

                } else if (event.getButton() == MouseEvent.BUTTON1) {
                  SparkManager.getMainWindow().toFront();
                  // SparkManager.getMainWindow().requestFocus();
                } else if (event.getButton() == MouseEvent.BUTTON3) {

                  if (popupMenu.isVisible()) {
                    popupMenu.setVisible(false);
                  } else {

                    double x = MouseInfo.getPointerInfo().getLocation().getX();
                    double y = MouseInfo.getPointerInfo().getLocation().getY();

                    if (Spark.isMac()) {
                      popupMenu.setLocation((int) x, (int) y);
                    } else {
                      popupMenu.setLocation(event.getX(), event.getY());
                    }

                    popupMenu.setInvoker(popupMenu);
                    popupMenu.setVisible(true);
                  }
                }
              }

              @Override
              public void mouseEntered(MouseEvent event) {}

              @Override
              public void mouseExited(MouseEvent event) {}

              @Override
              public void mousePressed(MouseEvent event) {

                // on Mac i would want the window to show when i left-click the Icon
                if (Spark.isMac() && event.getButton() != MouseEvent.BUTTON3) {
                  SparkManager.getMainWindow().setVisible(false);
                  SparkManager.getMainWindow().setVisible(true);
                  SparkManager.getMainWindow().requestFocusInWindow();
                  SparkManager.getMainWindow().bringFrameIntoFocus();
                  SparkManager.getMainWindow().toFront();
                  SparkManager.getMainWindow().requestFocus();
                }
              }

              @Override
              public void mouseReleased(MouseEvent event) {}
            });

        tray.add(trayIcon);
      } catch (Exception e) {
        // Not Supported
      }
    } else {
      Log.error("Tray don't supports on this platform.");
    }
  }
  private void createUI() {
    setLayout(new VerticalFlowLayout());
    timeFormat.add(format24);
    timeFormat.add(format12);
    final LocalPreferences pref = SettingsManager.getLocalPreferences();
    if (pref.getTimeFormat().equals("HH:mm")) {
      format24.setSelected(true);
    } else {
      format12.setSelected(true);
    }
    // Setup Mnemonics
    ResourceUtils.resButton(showTimeBox, Res.getString("checkbox.show.time.in.chat.window"));
    ResourceUtils.resLabel(
        passwordLabel, passwordField, Res.getString("label.change.password.to") + ":");
    ResourceUtils.resLabel(
        confirmationPasswordLabel,
        confirmationPasswordField,
        Res.getString("label.confirm.password") + ":");
    ResourceUtils.resButton(
        groupChatNotificationBox, Res.getString("checkbox.show.notifications.in.conference"));
    ResourceUtils.resButton(hideChatHistory, Res.getString("checkbox.disable.chat.history"));
    ResourceUtils.resButton(
        hidePrevChatHistory, Res.getString("checkbox.disable.prev.chat.history"));
    ResourceUtils.resButton(tabsOnTopBox, Res.getString("checkbox.tabs.on.top"));
    ResourceUtils.resButton(buzzBox, Res.getString("checkbox.allow.buzz"));

    generalPanel.setBorder(
        BorderFactory.createTitledBorder(Res.getString("group.general.information")));
    chatWindowPanel.setBorder(
        BorderFactory.createTitledBorder(Res.getString("group.chat.window.information")));

    if (!Default.getBoolean(Default.CHANGE_PASSWORD_DISABLED)) {
      add(generalPanel);
    }
    add(chatWindowPanel);

    generalPanel.setLayout(new GridBagLayout());
    chatWindowPanel.setLayout(new GridBagLayout());

    // Chat Window Panel settings
    chatWindowPanel.add(
        showTimeBox,
        new GridBagConstraints(
            0,
            0,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    chatWindowPanel.add(
        format24,
        new GridBagConstraints(
            1,
            0,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    chatWindowPanel.add(
        format12,
        new GridBagConstraints(
            2,
            0,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    chatWindowPanel.add(
        groupChatNotificationBox,
        new GridBagConstraints(
            0,
            1,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    chatWindowPanel.add(
        hideChatHistory,
        new GridBagConstraints(
            0,
            2,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    chatWindowPanel.add(
        hidePrevChatHistory,
        new GridBagConstraints(
            0,
            3,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    chatWindowPanel.add(
        tabsOnTopBox,
        new GridBagConstraints(
            0,
            4,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    chatWindowPanel.add(
        buzzBox,
        new GridBagConstraints(
            0,
            5,
            2,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));

    JLabel chatTimeoutLabel = new JLabel();
    ResourceUtils.resLabel(
        chatTimeoutLabel, chatTimeoutField, Res.getString("label.minutes.before.stale.chat") + ":");
    chatWindowPanel.add(
        chatTimeoutLabel,
        new GridBagConstraints(
            0,
            6,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    chatWindowPanel.add(
        chatTimeoutField,
        new GridBagConstraints(
            1,
            6,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            50,
            0));

    generalPanel.add(
        passwordLabel,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    generalPanel.add(
        passwordField,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            100,
            0));
    generalPanel.add(
        confirmationPasswordLabel,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            0,
            0));
    generalPanel.add(
        confirmationPasswordField,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE,
            new Insets(5, 5, 5, 5),
            100,
            0));

    showTimeBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (showTimeBox.isSelected()) {
              format12.setEnabled(true);
              format24.setEnabled(true);
            } else {
              format12.setEnabled(false);
              format24.setEnabled(false);
            }
          }
        });

    hideChatHistory.addActionListener(this);
  }