protected void updatePreference() throws Exception {

    try {
      timerProcesses.setDelay(preference.getProcessUpdateInterval() * 1000);
      timerResources.setDelay(Preference.getResourceUpdateinterval() * 1000);
      timerFileSystems.setDelay(preference.getFileSystemsUpdateInterval() * 1000);

      panelProcesses.setPreference(preference);
      panelResources.setPreference(preference);
      panelFileSystems.setPreference(preference);

      if (sshSession.isConnected()) {

        FileSystemInfo fileSystemInfo = FileSystemInfo.factory(sshSession);
        panelFileSystems.display(fileSystemInfo);

        ProcessInfo processinfo = ProcessInfo.factory(sshSession, sshUserInfo);
        panelProcesses.display(processinfo);
      }

      setProcessMenuItemsEnabled();

      repaint();

    } catch (Exception e) {

      e.printStackTrace();
      throw e;
    }
  }
  protected void setProcessMenuItemsEnabled() {

    boolean enabled =
        (tabbedPane.getSelectedIndex() == TAB_INDEX_PROCESS) && sshSession.isConnected();

    rdbtnmntmActiveProcesses.setEnabled(enabled);
    rdbtnmntmAllProcesses.setEnabled(enabled);
    rdbtnmntmMyProcesses.setEnabled(enabled);

    if ((panelProcesses != null) && panelProcesses.isRowSelected() && enabled) {

      mntmStopProcess.setEnabled(true);
      mntmContinueProcess.setEnabled(true);
      mntmEndProcess.setEnabled(true);
      mntmKillProcess.setEnabled(true);
      mntmChangePriority.setEnabled(true);

    } else {

      mntmStopProcess.setEnabled(false);
      mntmContinueProcess.setEnabled(false);
      mntmEndProcess.setEnabled(false);
      mntmKillProcess.setEnabled(false);
      mntmChangePriority.setEnabled(false);
    }
  }
        public void actionPerformed(ActionEvent e) {
          try {

            ProcessInfo processinfo = ProcessInfo.factory(sshSession, sshUserInfo);
            panelProcesses.display(processinfo);

          } catch (Exception e1) {
            e1.printStackTrace();
          }
        }
  private void runKillCommand(String killArg) throws Exception {

    try {
      long pid = panelProcesses.getSelectedProcessId();
      if (pid > -1) {

        String command = "kill " + killArg + " " + Long.toString(pid);

        try {

          if ((killArg.equals("-TERM") || killArg.equals("-KILL"))
              && preference.isAlertBeforeKillingProcess()) {

            int result =
                JOptionPane.showConfirmDialog(
                    this,
                    "Are you sure you want to terminate this process?",
                    "Confirm",
                    JOptionPane.OK_CANCEL_OPTION);

            if (result == JOptionPane.OK_OPTION) {

              sshSession.getStandardOutput(command);
            }

          } else {

            sshSession.getStandardOutput(command);
          }

        } catch (Exception e) {

          JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }

        updatePreference();
      }

    } catch (Exception e) {

      e.printStackTrace();
      throw e;
    }
  }