Exemple #1
0
  public void initUI() {
    scrollingToBottomCheckbox.setSelected(applicationPreferences.isScrollingToBottom());
    coloringWholeRowCheckbox.setSelected(applicationPreferences.isColoringWholeRow());
    showFullCallstackCheckbox.setSelected(applicationPreferences.isShowingFullCallstack());
    showStackTraceCheckbox.setSelected(applicationPreferences.isShowingStackTrace());
    usingWrappedExceptionStyleCheckbox.setSelected(
        applicationPreferences.isUsingWrappedExceptionStyle());

    // look and feel
    {
      ArrayList<String> lookAndFeels = new ArrayList<>();
      for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        lookAndFeels.add(info.getName());
      }
      Collections.sort(lookAndFeels);
      int selectedIndex = 0;
      String lookAndFeel = applicationPreferences.getLookAndFeel();
      if (lookAndFeel == null || "".equals(lookAndFeel)) {
        lookAndFeel = UIManager.getLookAndFeel().getName();
      }
      int idx = lookAndFeels.indexOf(lookAndFeel);
      if (idx > -1) {
        selectedIndex = idx;
      } else {
        idx = lookAndFeels.indexOf(ApplicationPreferences.STARTUP_LOOK_AND_FEEL);
        if (idx > -1) {
          selectedIndex = idx;
        }
      }
      lookAndFeelCombo.setModel(
          new DefaultComboBoxModel<>(lookAndFeels.toArray(new String[lookAndFeels.size()])));
      lookAndFeelCombo.setSelectedIndex(selectedIndex);
    }

    // default condition name
    {
      List<String> conditionNames = applicationPreferences.retrieveAllConditions();
      String defaultName = applicationPreferences.getDefaultConditionName();
      int idx = conditionNames.indexOf(defaultName);
      if (idx < 0) {
        idx = 0;
      }

      defaultConditionCombo.setModel(
          new DefaultComboBoxModel<>(conditionNames.toArray(new String[conditionNames.size()])));
      defaultConditionCombo.setSelectedIndex(idx);
    }
    String appPath = applicationPreferences.getApplicationPath().getAbsolutePath();
    appPathTextField.setText(appPath);
    appPathTextField.setToolTipText(appPath);

    globalLoggingEnabledCheckbox.setSelected(applicationPreferences.isGlobalLoggingEnabled());
    loggingStatsEnabledCheckbox.setSelected(applicationPreferences.isLoggingStatisticEnabled());
    trayActiveCheckbox.setSelected(applicationPreferences.isTrayActive());
    trayActiveCheckbox.setEnabled(TraySupport.isAvailable());
    hidingOnCloseCheckbox.setSelected(applicationPreferences.isHidingOnClose());
    hidingOnCloseCheckbox.setEnabled(TraySupport.isAvailable());
  }