java.awt.event.ActionEvent#getActionCommand()源码实例Demo

下面列出了java.awt.event.ActionEvent#getActionCommand() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: aion-germany   文件: LogDetailsPanel.java
public void actionPerformed(ActionEvent e)
{
    String cmd = e.getActionCommand();
    if (cmd.equals("save"))
    {
        _logFile.setComments(_commentEditor.getText());
    }
    Thread update = new Thread
    ( 
            new Runnable()
            {

                public void run()
                {
                    RemoteLogRepositoryBackend.getInstance().updateLogDetails(_logFile);
                }

            }
    );
    update.setName("LogFile Details Updater Thread");
    update.start();
    LogRepository.getInstance().runSaveDatabase();
}
 
源代码2 项目: openjdk-jdk9   文件: StyledEditorKit.java
/**
 * Sets the foreground color.
 *
 * @param e the action event
 */
public void actionPerformed(ActionEvent e) {
    JEditorPane editor = getEditor(e);
    if (editor != null) {
        Color fg = this.fg;
        if ((e != null) && (e.getSource() == editor)) {
            String s = e.getActionCommand();
            try {
                fg = Color.decode(s);
            } catch (NumberFormatException nfe) {
            }
        }
        if (fg != null) {
            MutableAttributeSet attr = new SimpleAttributeSet();
            StyleConstants.setForeground(attr, fg);
            setCharacterAttributes(editor, attr, false);
        } else {
            UIManager.getLookAndFeel().provideErrorFeedback(editor);
        }
    }
}
 
源代码3 项目: openjdk-jdk8u   文件: Test4759934.java
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (CMD_DIALOG.equals(command)) {
        JDialog dialog = new JDialog(this.frame, "Dialog"); // NON-NLS: dialog title
        dialog.setLocation(200, 0);
        show(dialog, CMD_CHOOSER);
    }
    else if (CMD_CHOOSER.equals(command)) {
        Object source = event.getSource();
        Component component = (source instanceof Component)
                ? (Component) source
                : null;

        JColorChooser.showDialog(component, "ColorChooser", Color.BLUE); // NON-NLS: title
    }
}
 
源代码4 项目: Java8CN   文件: StyledEditorKit.java
/**
 * Sets the font size.
 *
 * @param e the action event
 */
public void actionPerformed(ActionEvent e) {
    JEditorPane editor = getEditor(e);
    if (editor != null) {
        int size = this.size;
        if ((e != null) && (e.getSource() == editor)) {
            String s = e.getActionCommand();
            try {
                size = Integer.parseInt(s, 10);
            } catch (NumberFormatException nfe) {
            }
        }
        if (size != 0) {
            MutableAttributeSet attr = new SimpleAttributeSet();
            StyleConstants.setFontSize(attr, size);
            setCharacterAttributes(editor, attr, false);
        } else {
            UIManager.getLookAndFeel().provideErrorFeedback(editor);
        }
    }
}
 
源代码5 项目: jdk8u-jdk   文件: Test4759934.java
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (CMD_DIALOG.equals(command)) {
        JDialog dialog = new JDialog(this.frame, "Dialog"); // NON-NLS: dialog title
        dialog.setLocation(200, 0);
        show(dialog, CMD_CHOOSER);
    }
    else if (CMD_CHOOSER.equals(command)) {
        Object source = event.getSource();
        Component component = (source instanceof Component)
                ? (Component) source
                : null;

        JColorChooser.showDialog(component, "ColorChooser", Color.BLUE); // NON-NLS: title
    }
}
 
源代码6 项目: openjdk-jdk8u   文件: CardTest.java
@Override
public void actionPerformed(ActionEvent e) {
    String arg = e.getActionCommand();

    if ("first".equals(arg)) {
        ((CardLayout) cards.getLayout()).first(cards);
    } else if ("next".equals(arg)) {
        ((CardLayout) cards.getLayout()).next(cards);
    } else if ("previous".equals(arg)) {
        ((CardLayout) cards.getLayout()).previous(cards);
    } else if ("last".equals(arg)) {
        ((CardLayout) cards.getLayout()).last(cards);
    } else {
        ((CardLayout) cards.getLayout()).show(cards, arg);
    }
}
 
源代码7 项目: openjdk-jdk9   文件: DefaultEditorKit.java
/**
 * The operation to perform when this action is triggered.
 *
 * @param e the action event
 */
public void actionPerformed(ActionEvent e) {
    JTextComponent target = getTextComponent(e);
    if ((target != null) && (e != null)) {
        if ((! target.isEditable()) || (! target.isEnabled())) {
            return;
        }
        String content = e.getActionCommand();
        int mod = e.getModifiers();
        if ((content != null) && (content.length() > 0)) {
            boolean isPrintableMask = true;
            Toolkit tk = Toolkit.getDefaultToolkit();
            if (tk instanceof SunToolkit) {
                isPrintableMask = ((SunToolkit)tk).isPrintableCharacterModifiersMask(mod);
            }

            if (isPrintableMask) {
                char c = content.charAt(0);
                if ((c >= 0x20) && (c != 0x7F)) {
                    target.replaceSelection(content);
                }
            }
        }
    }
}
 
源代码8 项目: rtg-tools   文件: RocLinesPanel.java
@Override
public void actionPerformed(ActionEvent e) {
  final Component[] components = getComponents();
  for (final Component component : components) {
    final RocLinePanel cp = (RocLinePanel) component;
    if (cp == mPanel) {
      switch (e.getActionCommand()) {
        case "remove":
          remove(mPanel);
          mRocPlot.mData.remove(mPanel.getPath());
          break;
        default:
          System.err.println("Unhandled event!");
      }
      updateCurves();
      break;
    }
  }
}
 
源代码9 项目: jdk8u60   文件: StyledEditorKit.java
/**
 * Sets the font family.
 *
 * @param e the event
 */
public void actionPerformed(ActionEvent e) {
    JEditorPane editor = getEditor(e);
    if (editor != null) {
        String family = this.family;
        if ((e != null) && (e.getSource() == editor)) {
            String s = e.getActionCommand();
            if (s != null) {
                family = s;
            }
        }
        if (family != null) {
            MutableAttributeSet attr = new SimpleAttributeSet();
            StyleConstants.setFontFamily(attr, family);
            setCharacterAttributes(editor, attr, false);
        } else {
            UIManager.getLookAndFeel().provideErrorFeedback(editor);
        }
    }
}
 
源代码10 项目: brModelo   文件: Diagrama.java
public void DoAction(ActionEvent ev) {
    if (ev.getActionCommand() == null || ev.getActionCommand().isEmpty()) {
        setComando(null);
        return;
    }
    try {
        Controler.Comandos cmd = Controler.Comandos.valueOf(ev.getActionCommand());
        if (comando != cmd) {
            cliq1 = null;
            cliq2 = null;
        }
        setComando(cmd);
    } catch (Exception e) {
        setComando(null);
    }
}
 
源代码11 项目: openjdk-jdk8u   文件: FileChooserDemo.java
public void actionPerformed(ActionEvent evt) {
    Object src = evt.getSource();
    String cmd = evt.getActionCommand();

    if (src == backButton) {
        back();
    } else if (src == nextButton) {
        FileChooserUI ui = chooser.getUI();
        if (ui instanceof BasicFileChooserUI) {
            // Workaround for bug 4528663. This is necessary to
            // pick up the contents of the file chooser text field.
            // This will trigger an APPROVE_SELECTION action.
            ((BasicFileChooserUI) ui).getApproveSelectionAction().
                    actionPerformed(null);
        } else {
            next();
        }
    } else if (src == closeButton) {
        close();
    } else if (APPROVE_SELECTION.equals(cmd)) {
        next();
    } else if (CANCEL_SELECTION.equals(cmd)) {
        close();
    }
}
 
源代码12 项目: ramus   文件: WebPanel.java
protected void actionPerformed(final ActionEvent e) {
    final String s = e.getActionCommand();
    if (GO_TO_URL.equals(s))
        goToURL(false);
    else if (GO_BACK.equals(s)) {
        jTextField.setText(history.back());
        goToURL(true);
    } else if (GO_NEXT.equals(s)) {
        jTextField.setText(history.next());
        goToURL(true);
    }
}
 
源代码13 项目: gcs   文件: ListOutline.java
@Override
public void actionPerformed(ActionEvent event) {
    Object source  = event.getSource();
    String command = event.getActionCommand();

    if (source instanceof OutlineProxy) {
        source = ((OutlineProxy) source).getRealOutline();
    }
    if (source == this && Outline.CMD_OPEN_SELECTION.equals(command)) {
        openDetailEditor(false);
    }
}
 
源代码14 项目: gcs   文件: CharacterSheet.java
@Override
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (Outline.CMD_POTENTIAL_CONTENT_SIZE_CHANGE.equals(command)) {
        mRootsToSync.add(((Outline) event.getSource()).getRealOutline());
        markForRebuild();
    }
}
 
/** Fires action event */
@Override
public void loggedActionPerformed(ActionEvent e) {
	String actionCommand = e.getActionCommand();
	Action action = tree.getActionMap().get(actionCommand);
	if (action != null) {
		action.actionPerformed(new ActionEvent(tree, ActionEvent.ACTION_PERFORMED, actionCommand));
	}
}
 
源代码16 项目: SIMVA-SoS   文件: DefaultLogAxisEditor.java
/**
 * Handles actions from within the property panel.
 * 
 * @param event an event.
 */
@Override
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (command.equals("TickUnitValue")) {
        validateTickUnit();
    }
    else {
        // pass to the super-class for handling
        super.actionPerformed(event);
    }
}
 
源代码17 项目: darklaf   文件: ToolBarDemo.java
public void actionPerformed(final ActionEvent e) {
    String cmd = e.getActionCommand();
    String description = null;

    // Handle each button.
    if (PREVIOUS.equals(cmd)) { // first button clicked
        description = "taken you to the previous <something>.";
    } else if (UP.equals(cmd)) { // second button clicked
        description = "taken you up one level to <something>.";
    } else if (NEXT.equals(cmd)) { // third button clicked
        description = "taken you to the next <something>.";
    }

    displayResult("If this were a real app, it would have " + description);
}
 
源代码18 项目: HackBar   文件: XXE_Menu.java
@Override
public void actionPerformed(ActionEvent e) {
    int[] selectedIndex = myburp.context.getSelectionBounds();
    IHttpRequestResponse req = myburp.context.getSelectedMessages()[0];
    byte[] request = req.getRequest();
    byte[] param = new byte[selectedIndex[1]-selectedIndex[0]];
    System.arraycopy(request, selectedIndex[0], param, 0, selectedIndex[1]-selectedIndex[0]);
    String selectString = new String(param);
    String action = e.getActionCommand();
    byte[] newRequest = do_XXE(request, selectString, action, selectedIndex);
    req.setRequest(newRequest);
}
 
源代码19 项目: ccu-historian   文件: DefaultLogAxisEditor.java
/**
 * Handles actions from within the property panel.
 * 
 * @param event an event.
 */
@Override
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (command.equals("TickUnitValue")) {
        validateTickUnit();
    }
    else {
        // pass to the super-class for handling
        super.actionPerformed(event);
    }
}
 
源代码20 项目: Bytecoder   文件: InputMethodPopupMenu.java
public void actionPerformed(ActionEvent event) {
    String choice = event.getActionCommand();
    ((ExecutableInputMethodManager)InputMethodManager.getInstance()).changeInputMethod(choice);
}