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:net.datacrow.console.windows.charts.ChartPanel.java

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("buildChart")) {
        buildChart();/*from  www  . j av a  2  s.  c  o  m*/
    }
}

From source file:es.emergya.ui.gis.popups.ListaCapas.java

@Override
public void actionPerformed(ActionEvent e) {
    for (Layer l : mapView.getAllLayers()) {
        if (l.name.equals(e.getActionCommand())) {
            l.visible = ((JCheckBox) e.getSource()).isSelected();
            mapView.repaint();//  w  w w .  j  a  va  2 s .co  m
            return;
        }
    }
}

From source file:com.sec.ose.osi.ui.frm.main.manage.dialog.JDlgProjectAdd.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("OK")) {
        projectListTableModel.saveSelectedIndex();
        if (jPanProjectMain != null) {
            jPanProjectMain.updateProjectList();
        }//w w  w. ja v  a 2 s . c  o  m
        if (jPanReportMain != null) {
            jPanReportMain.resetProjectList();
        }

    } else {
        projectListTableModel.recoveySelectedIndex();
    }
    setVisible(false);
}

From source file:it.unibo.alchemist.boundary.gui.Perspective.java

@Override
public void actionPerformed(final ActionEvent e) {
    if (Commands.OPEN.equalsToString(e.getActionCommand())) {
        openFile();/*from   w w  w .j  a  v a 2 s .c  o  m*/
    } else if (Commands.PARALLEL.equalsToString(e.getActionCommand())) {
        process(true);
    } else if (Commands.PROCESS.equalsToString(e.getActionCommand())) {
        process(false);
    } else if (Commands.DICE.equalsToString(e.getActionCommand())) {
        setRandom();
    } else if (SimControlCommand.PLAY.equalsToString(e.getActionCommand())) {
        sim.addCommand(new Engine.StateCommand<T>().run().build());
        bar.setPlay(true);
    } else if (SimControlCommand.PAUSE.equalsToString(e.getActionCommand())) {
        sim.addCommand(new Engine.StateCommand<T>().pause().build());
        bar.setPlay(false);
    } else if (SimControlCommand.STEP.equalsToString(e.getActionCommand())) {
        sim.addCommand(new Engine.StateCommand<T>().run().build());
        sim.addCommand(new Engine.StateCommand<T>().pause().build());
    } else if (SimControlCommand.STOP.equalsToString(e.getActionCommand())) {
        sim.addCommand(new Engine.StateCommand<T>().stop().build());
        bar.setFileOK(true);
    } else if (Commands.REACTIVITY.equalsToString(e.getActionCommand())) {
        switch (bar.getReactivityStatus()) {
        case MAX_REACTIVITY:
            main.setStep(1);
            main.setRealTime(false);
            break;
        case REAL_TIME:
            main.setRealTime(true);
            main.setStep(1);
            break;
        case USER_SELECTED:
            main.setStep(bar.getReactivity());
            main.setRealTime(false);
            break;
        default:
            break;
        }
    } else {
        dispose();
    }
}

From source file:StoppUhr.java

private void startButtonListener(ActionEvent evt) {
    if (evt.getActionCommand().equals("Start")) {
        startButton.setText("Pause");
        action = "start";
    } else if (evt.getActionCommand().equals("Pause")) {
        action = "suspend";
        startButton.setText("Resume");
    } else {//from w  ww .  j  a va 2 s. c o m
        action = "resume";
        startButton.setText("Pause");
    }

    try {
        Thread.sleep(100);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    jTextFieldStNr.requestFocus();
}

From source file:TextSamplerDemo.java

public void actionPerformed(ActionEvent e) {
    String prefix = "You typed \"";
    if (textFieldString.equals(e.getActionCommand())) {
        JTextField source = (JTextField) e.getSource();
        actionLabel.setText(prefix + source.getText() + "\"");
    } else if (passwordFieldString.equals(e.getActionCommand())) {
        JPasswordField source = (JPasswordField) e.getSource();
        actionLabel.setText(prefix + new String(source.getPassword()) + "\"");
    } else if (buttonString.equals(e.getActionCommand())) {
        Toolkit.getDefaultToolkit().beep();
    }/* ww w.j  a va2s. c o m*/
}

From source file:ch.zhaw.simulation.diagram.charteditor.DefaultNumberAxisEditor.java

/**
 * Handles actions from within the property panel.
 * //from   w  w w  . j  ava 2s . co  m
 * @param event
 *            an event.
 */
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (command.equals("GridStroke")) {
        attemptGridStrokeSelection();
    } else if (command.equals("GridPaint")) {
        attemptGridPaintSelection();
    } else if (command.equals("AutoRangeOnOff")) {
        toggleAutoRange();
    } else if (command.equals("MinimumRange")) {
        validateMinimum();
    } else if (command.equals("MaximumRange")) {
        validateMaximum();
    } else {
        // pass to the super-class for handling
        super.actionPerformed(event);
    }
}

From source file:org.astrojournal.gui.AJMainGUI.java

@Override
public void actionPerformed(ActionEvent ae) {
    String action = ae.getActionCommand();
    if (action.equals(AJGUIActions.CREATE_JOURNAL.name())) {
        createJournals();//from w ww  .j a v a2 s  .com
    } else if (action.equals(AJGUIActions.OPEN_JOURNAL.name())) {
        openJournals();
    } else if (action.equals(AJGUIActions.QUIT.name())) {
        quit();
    } else {
        log.error(resourceBundle.getString("AJ.errCommandNotFound.text") + action);
        JOptionPane.showMessageDialog(this, resourceBundle.getString("AJ.errCommandNotFound.text") + action,
                resourceBundle.getString("AJ.errCommandNotFound.text"), JOptionPane.ERROR_MESSAGE);
    }
}

From source file:ca.sfu.federation.viewer.propertysheet.AssemblyPropertySheet.java

private void jtfDescriptionActionListener(java.awt.event.ActionEvent evt) {
    String command = evt.getActionCommand();
    logger.log(Level.FINE, "AssemblySheet jtfDescriptionActionListener fired {0}", command);
    try {//from w ww.j av a2 s.  co  m
        BeanProxy proxy = new BeanProxy(this.target);
        proxy.set("description", evt.getActionCommand());
    } catch (IntrospectionException ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "Could not get description field value\n\n{0}", stack);
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "Could not get description field value\n\n{0}", stack);
    }
}

From source file:ca.sfu.federation.viewer.propertysheet.AssemblyPropertySheet.java

private void jtfNameActionListener(java.awt.event.ActionEvent evt) {
    String command = evt.getActionCommand();
    logger.log(Level.FINE, "AssemblySheet jtfNameActionListener fired {0}", command);
    try {//from  w  w w  . j av  a  2  s. c  o m
        BeanProxy proxy = new BeanProxy(this.target);
        proxy.set("name", evt.getActionCommand());
    } catch (IntrospectionException ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "Could not get name field value\n\n{0}", stack);
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "Could not get name field value\n\n{0}", stack);
    }
}