Example usage for java.awt.event ActionEvent getActionCommand

List of usage examples for java.awt.event ActionEvent getActionCommand

Introduction

In this page you can find the example usage for java.awt.event ActionEvent getActionCommand.

Prototype

public String getActionCommand() 

Source Link

Document

Returns the command string associated with this action.

Usage

From source file:Flipper.java

public void actionPerformed(ActionEvent e) {
    if ("Start" == e.getActionCommand()) {
        startButton.setEnabled(false);//  w  w  w . j av  a  2  s .  c  o  m
        stopButton.setEnabled(true);
        (flipTask = new FlipTask()).execute();
    } else if ("Stop" == e.getActionCommand()) {
        startButton.setEnabled(true);
        stopButton.setEnabled(false);
        flipTask.cancel(true);
        flipTask = null;
    }

}

From source file:it.unibas.spicygui.controllo.provider.intermediatezone.MyPopupProviderDeleteConst.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals(DELETE)) {
        StatusDisplayer.getDefault()/* w w  w .  j a v a  2  s  .c o  m*/
                .setStatusText(NbBundle.getMessage(Costanti.class, Costanti.GENERIC_DELETE));
        deleteAll();
    } else {
        StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(Costanti.class, Costanti.GENERIC_ERROR));
    }
}

From source file:SwingButtonDemo.java

public void actionPerformed(ActionEvent e) {
    if ("disable".equals(e.getActionCommand())) {
        b2.setEnabled(false);/*from ww w  .j  a  va  2  s. c  o  m*/
        b1.setEnabled(false);
        b3.setEnabled(true);
    } else {
        b2.setEnabled(true);
        b1.setEnabled(true);
        b3.setEnabled(false);
    }
}

From source file:it.unibas.spicygui.controllo.provider.MyPopupProviderConnectionInfo.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals(HIDE_CONNECTION_INFO)) {
        StatusDisplayer.getDefault()/* w  w  w. jav  a  2 s .  com*/
                .setStatusText(NbBundle.getMessage(Costanti.class, Costanti.HIDE_INFO_CONNECTION));
        hideInfo();
        //        } else if (e.getActionCommand().equals(SET_IMPLIED)) {
        //            setImplied();
    } else {
        StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(Costanti.class, Costanti.GENERIC_ERROR));
    }
}

From source file:CustomIconDemo.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("disable")) {
        b2.setEnabled(false);/* www .  j a  v  a 2  s. c o  m*/
        b1.setEnabled(false);
        b3.setEnabled(true);
    } else {
        b2.setEnabled(true);
        b1.setEnabled(true);
        b3.setEnabled(false);
    }
}

From source file:de.weltraumschaf.minesweeper.control.ResizeFieldListener.java

@Override
public void actionPerformed(final ActionEvent e) {
    final Size size = Size.getForActioncommand(e.getActionCommand());
    LOG.debug(String.format("Resize mine field to %s.", size));
    final Game game = session.getCurrentGame();

    if (game.hasSize(size)) {
        LOG.debug("Same size. Ignore change event.");
        return;//from  w  w  w .  j a  v a 2s  .  c om
    }

    game.stop();
    game.setSize(size);
    main.setMineField(game.getMineField());
    game.start();
    main.repaint();
}

From source file:MultiListener.java

public void actionPerformed(ActionEvent e) {
    myTextArea.append(e.getActionCommand() + MultiListener.newline);
    myTextArea.setCaretPosition(myTextArea.getDocument().getLength());
}

From source file:MultiListener.java

public void actionPerformed(ActionEvent e) {
    topTextArea.append(e.getActionCommand() + newline);
    topTextArea.setCaretPosition(topTextArea.getDocument().getLength());
}

From source file:it.unibas.spicygui.controllo.provider.MyPopupProviderConnectionSpicy.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals(SHOW)) {
        StatusDisplayer.getDefault()//from  w  w  w .j a v a 2s  .c om
                .setStatusText(NbBundle.getMessage(Costanti.class, Costanti.SHOW_HIDE_INFO_CONNECTION));
        Widget popUpMenu = null;
        for (Widget widget : connection.getChildren()) {
            if (widget instanceof VMDNodeWidget) {
                popUpMenu = widget;
                break;
            }
        }
        if (popUpMenu != null) {
            popUpMenu.removeFromParent();
            scene.validate();
        } else {
            showInfo();
        }
    } else {
        deleteConnection();
    }
}

From source file:com.jdom.util.patterns.mvp.swing.RadioButtonGroupDialog.java

public void actionPerformed(ActionEvent e) {
    if ("OK".equals(e.getActionCommand())) {
        for (Component comp : panel.getComponents()) {
            if (comp instanceof JRadioButton) {
                JRadioButton checkbox = (JRadioButton) comp;
                if (checkbox.isSelected()) {
                    RadioButtonGroupDialog.selectedValue = checkbox.getText();
                }/*from  w  w  w. j  a  va  2 s .c  o  m*/
            }
        }
    }
    RadioButtonGroupDialog.dialog.setVisible(false);
}