public void commitChanges() {
   act.setAppliesTo(getApplies());
   if (relativeBox != null) act.setRelative(relativeBox.isSelected());
   if (notBox != null) act.setNot(notBox.isSelected());
   switch (act.getLibAction().interfaceKind) {
     case LibAction.INTERFACE_CODE:
       act.getArguments().get(0).setVal(code.getTextCompat());
       break;
     default:
       for (ArgumentComponent a : argComp) a.commit();
   }
 }
  // Must be delegated through ActionFrame(Action)
  private ActionFrame(Action a, LibAction la) {
    super(la.description, false);
    if (la.parent == null) setTitle(Messages.getString("Action.UNKNOWN")); // $NON-NLS-1$
    if (la.actImage != null)
      setFrameIcon(new ImageIcon(la.actImage.getScaledInstance(16, 16, Image.SCALE_SMOOTH)));
    String s;
    ResourceReference<GmObject> at = a.getAppliesTo();
    if (at == GmObject.OBJECT_SELF) s = Messages.getString("ActionFrame.SELF"); // $NON-NLS-1$
    else s = Messages.getString("ActionFrame.OTHER"); // $NON-NLS-1$
    appliesObject = new ResourceMenu<GmObject>(Resource.Kind.OBJECT, s, false, 100);
    appliesObject.setEnabled(GmObject.refAsInt(at) >= 0);
    appliesObject.setOpaque(false);
    appliesObject.setSelected(at);
    act = a;

    appliesPanel = new JPanel();
    appliesPanel.setOpaque(false);
    appliesPanel.setLayout(new GridBagLayout());

    GridBagConstraints gbc;
    applies = new IndexButtonGroup(3, true, false);
    JRadioButton button = new JRadioButton(Messages.getString("ActionFrame.SELF")); // $NON-NLS-1$
    button.setOpaque(false);
    applies.add(button, -1);
    gbc = new GridBagConstraints();
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    appliesPanel.add(button, gbc);
    button = new JRadioButton(Messages.getString("ActionFrame.OTHER")); // $NON-NLS-1$
    button.setOpaque(false);
    applies.add(button, -2);
    gbc = new GridBagConstraints();
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    appliesPanel.add(button, gbc);
    button = new JRadioButton(Messages.getString("ActionFrame.OBJECT")); // $NON-NLS-1$
    button.setHorizontalAlignment(JRadioButton.LEFT);
    button.setOpaque(false);
    button.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            boolean sel = ((JRadioButton) e.getSource()).isSelected();
            appliesObject.setEnabled(sel);
          }
        });
    applies.add(button, 0);
    gbc = new GridBagConstraints();
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    appliesPanel.add(button, gbc);
    gbc = new GridBagConstraints();
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1.0;
    gbc.insets = new Insets(0, 2, 0, 6);
    appliesPanel.add(appliesObject, gbc);
    applies.setValue(Math.min(GmObject.refAsInt(at), 0));

    if (la.interfaceKind == LibAction.INTERFACE_CODE) {
      setSize(600, 400);
      setClosable(true);
      setMaximizable(true);
      setResizable(true);
      setIconifiable(true);

      tool = new JToolBar();
      tool.setFloatable(false);
      tool.setAlignmentX(0);
      save = new JButton(LGM.getIconForKey("ActionFrame.SAVE")); // $NON-NLS-1$
      save.addActionListener(this);
      //			add(save);
      tool.add(save);
      tool.addSeparator();

      code = new GMLTextArea(a.getArguments().get(0).getVal());
      code.addEditorButtons(tool);

      tool.addSeparator();
      tool.add(new JLabel(Messages.getString("ActionFrame.APPLIES"))); // $NON-NLS-1$
      tool.add(appliesPanel);

      status = new JPanel(new FlowLayout());
      status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS));
      status.setMaximumSize(new Dimension(Integer.MAX_VALUE, 11));
      final JLabel caretPos =
          new JLabel((code.getCaretLine() + 1) + ":" + (code.getCaretColumn() + 1));
      status.add(caretPos);
      code.addCaretListener(
          new CaretListener() {
            public void caretUpdate(CaretEvent e) {
              caretPos.setText((code.getCaretLine() + 1) + ":" + (code.getCaretColumn() + 1));
            }
          });

      add(tool, BorderLayout.NORTH);
      add(code, BorderLayout.CENTER);
      add(status, BorderLayout.SOUTH);

      setFocusTraversalPolicy(new TextAreaFocusTraversalPolicy(code));
      appliesPanel.setLayout(new BoxLayout(appliesPanel, BoxLayout.LINE_AXIS));
    } else makeArgumentPane(a, la);
    pack();
    repaint();
    SubframeInformer.fireSubframeAppear(this);
  }
 // updatable only, no revert
 @Override
 public boolean resourceChanged() {
   return act.getLibAction().interfaceKind == LibAction.INTERFACE_CODE
       && (code.getUndoManager().isModified() || !act.getAppliesTo().equals(getApplies()));
 }