コード例 #1
0
 private CodeFrame newCodeFrame(CodeHolder ch, String title) {
   CodeFrame cf = new CodeFrame(ch, "{0}", title); // $NON-NLS-1$
   cf.addInternalFrameListener(ifl);
   LGM.mdi.add(cf);
   LGM.mdi.addZChild(this, cf);
   return cf;
 }
コード例 #2
0
  @Override
  public void actionPerformed(ActionEvent e) {
    super.actionPerformed(e);
    Object s = e.getSource();

    if (s == loadFile) {
      loadFromFile();
      return;
    }

    if (s == saveFile) {
      saveToFile();
      return;
    }

    if (s == bDef || s == bGlobLoc || s == bInit || s == bClean) {
      if (s == bDef) {
        if (cfDef == null)
          cfDef =
              newCodeFrame(
                  sDef,
                  Messages.getString("EnigmaSettingsFrame.CODE_TITLE_DEFINITIONS")); // $NON-NLS-1$
        cfDef.toTop();
      }
      if (s == bGlobLoc) {
        if (cfDef == null)
          cfGlobLoc =
              newCodeFrame(
                  sGlobLoc,
                  Messages.getString(
                      "EnigmaSettingsFrame.CODE_TITLE_GLOBAL_LOCALS")); //$NON-NLS-1$
        cfGlobLoc.toTop();
      }
      if (s == bInit) {
        if (cfInit == null)
          cfInit =
              newCodeFrame(
                  sInit,
                  Messages.getString(
                      "EnigmaSettingsFrame.CODE_TITLE_INITIALIZATION")); //$NON-NLS-1$
        cfInit.toTop();
      }
      if (s == bClean) {
        if (cfClean == null)
          cfClean =
              newCodeFrame(
                  sClean,
                  Messages.getString("EnigmaSettingsFrame.CODE_TITLE_CLEANUP")); // $NON-NLS-1$
        cfClean.toTop();
      }
      return;
    }

    String targSys = targets.get(s);
    if (targSys != null) {
      if (changing) return;

      JComboBox changedSystem = (JComboBox) s;
      TargetSelection changedSelection = (TargetSelection) changedSystem.getSelectedItem();

      // Update author and description
      if (changedSystem.hasFocus()) {
        tfAuth.setText(changedSelection.auth);
        taDesc.setText(changedSelection.desc);
      }

      // repopulate the boxes
      userPicks.put(targSys, changedSelection);
      changedSystem.setFont(changedSystem.getFont().deriveFont(Font.BOLD));
      populateTargets();

      // now trample the other cancelled selections
      changing = true;
      for (Entry<JComboBox, String> systems : targets.entrySet())
        if (systems.getKey() != changedSystem && userPicks.get(systems.getValue()) == null)
          systems.getKey().setSelectedIndex(0);
      changing = false;
    }
  }