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:ca.sfu.federation.viewer.propertysheet.AssemblyPropertySheet.java

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

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

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

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

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

From source file:net.sf.mzmine.modules.visualization.scatterplot.scatterplotchart.ScatterPlotChart.java

public void actionPerformed(ActionEvent event) {

    super.actionPerformed(event);

    String command = event.getActionCommand();

    if (command.equals("SETUP_AXES")) {
        AxesSetupDialog dialog = new AxesSetupDialog(plot);
        dialog.setVisible(true);/*from  w w w . j av a  2s. c om*/
        return;
    }

    if (command.equals("TIC")) {

        double valueX = plot.getDomainCrosshairValue();
        double valueY = plot.getRangeCrosshairValue();
        PeakListRow selectedRow = mainDataSet.getRow(valueX, valueY);

        if (selectedRow == null) {
            MZmineCore.getDesktop().displayErrorMessage("No peak is selected");
            return;
        }

        Feature[] peaks = selectedRow.getPeaks();
        Range rtRange = peakList.getRowsRTRange();
        Range mzRange = null;

        for (Feature p : peaks) {
            if (mzRange == null) {
                mzRange = p.getRawDataPointsMZRange();
            } else {
                mzRange.extendRange(p.getRawDataPointsMZRange());
            }
        }

        // Label best peak with preferred identity.
        final Feature bestPeak = selectedRow.getBestPeak();
        final PeakIdentity peakIdentity = selectedRow.getPreferredPeakIdentity();
        final Map<Feature, String> labelMap = new HashMap<Feature, String>(1);
        if (bestPeak != null && peakIdentity != null) {

            labelMap.put(bestPeak, peakIdentity.getName());
        }

        TICVisualizerModule.showNewTICVisualizerWindow(peakList.getRawDataFiles(), peaks, labelMap, 1,
                PlotType.BASEPEAK, rtRange, mzRange);
    }
}

From source file:WebCrawler.java

public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();

    if (command.compareTo(SEARCH) == 0) {
        setStatus("searching...");

        // launch a thread to do the search
        if (searchThread == null) {
            searchThread = new Thread(this);
        }/* ww  w  .j  a va2  s . com*/
        searchThread.start();
    } else if (command.compareTo(STOP) == 0) {
        stop();
    }
}

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

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals(i18n.getString("Buttons.send"))) {
        bandejaSalida = send();//from  w w w  .j  av  a 2s .  c o m

        if (bandejaSalida == null) {
            return;
        }

        notification.setForeground(Color.WHITE);
        progressIcon.setIcon(iconEnviando);
        send.setEnabled(false);
        sds.setEnabled(false);

        SendActionListener listener = new SendActionListener(bandejaSalida);
        final Timer t = new Timer(1000, listener);

        listener.setTimer(t);
        t.start();
    } else if (e.getActionCommand().equals(i18n.getString("Buttons.cancel"))) {
        if (bandejaSalida != null) {
            MessageGenerator.remove(bandejaSalida.getId());
        }

        bandejaSalida = null;
        dispose();
    }
}

From source file:org.ietr.preesm.mapper.ui.BestCostPlotter.java

/**
 * Handles a click on the button and perform the wanted action.
 * /*  w  ww . ja v  a  2 s .c o  m*/
 * @param e
 *            the action event.
 */
@Override
public void actionPerformed(final ActionEvent e) {

    for (int i = 0; i < subplotCount; i++) {
        if (e.getActionCommand().endsWith(String.valueOf(i))) {
            // final Millisecond now = new Millisecond();
            // System.out.println("Now = " + now.toString());
            this.lastValue[i] = this.lastValue[i] * (0.90 + 0.2 * Math.random());
            this.datasets[i].getSeries(0).add(new Millisecond(), this.lastValue[i]);
        }
    }

    if (e.getActionCommand().equals("pause")) {

        this.setActionType(2);

    }

    if (e.getActionCommand().equals("ADD_ALL")) {
        this.setActionType(1);
    }

    if (e.getActionCommand().equals("Lecture")) {
        this.setActionType(0);
    }
}

From source file:net.chaosserver.timelord.swingui.TaskDayPanel.java

/**
 * Listens for buttons on the actions and triggers proper handling.
 *
 * @param evt the action event/*from  w  w  w  . jav  a2 s  .c  o  m*/
 */
public void actionPerformed(ActionEvent evt) {
    if (ACTION_ADD_15.equals(evt.getActionCommand())) {
        getTodayTaskDay(true).addHours(DateUtil.getSmallestTimeIncremented());

    } else if (ACTION_MINUS_15.equals(evt.getActionCommand())) {
        getTodayTaskDay(true).addHours(-DateUtil.getSmallestTimeIncremented());
    }
}

From source file:com.floreantpos.config.ui.DatabaseConfigurationView.java

public void actionPerformed(ActionEvent e) {
    try {/*  w ww .j av a 2s.  c  o m*/
        String command = e.getActionCommand();

        Database selectedDb = (Database) databaseCombo.getSelectedItem();

        String providerName = selectedDb.getProviderName();
        String databaseURL = tfServerAddress.getText();
        String databasePort = tfServerPort.getText();
        String databaseName = tfDatabaseName.getText();
        String user = tfUserName.getText();
        String pass = new String(tfPassword.getPassword());

        String connectionString = selectedDb.getConnectString(databaseURL, databasePort, databaseName);
        String hibernateDialect = selectedDb.getHibernateDialect();
        String driverClass = selectedDb.getHibernateConnectionDriverClass();

        if (TEST.equalsIgnoreCase(command)) {
            Application.getInstance().setSystemInitialized(false);
            saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass,
                    connectionString, hibernateDialect);

            try {
                DatabaseUtil.checkConnection(connectionString, hibernateDialect, driverClass, user, pass);
            } catch (DatabaseConnectionException e1) {
                JOptionPane.showMessageDialog(this, Messages.getString("DatabaseConfigurationDialog.32")); //$NON-NLS-1$
                return;
            }

            JOptionPane.showMessageDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("DatabaseConfigurationDialog.31")); //$NON-NLS-1$
        } else if (CONFIGURE_DB.equals(command)) {
            Application.getInstance().setSystemInitialized(false);

            int i = JOptionPane.showConfirmDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("DatabaseConfigurationDialog.33"), //$NON-NLS-1$
                    Messages.getString("DatabaseConfigurationDialog.34"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$
            if (i != JOptionPane.YES_OPTION) {
                return;
            }

            i = JOptionPane.showConfirmDialog(POSUtil.getBackOfficeWindow(),
                    Messages.getString("DatabaseConfigurationView.3"), //$NON-NLS-1$
                    Messages.getString("DatabaseConfigurationView.4"), JOptionPane.YES_NO_OPTION); //$NON-NLS-1$
            boolean generateSampleData = false;
            if (i == JOptionPane.YES_OPTION)
                generateSampleData = true;

            saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass,
                    connectionString, hibernateDialect);

            String connectionString2 = selectedDb.getCreateDbConnectString(databaseURL, databasePort,
                    databaseName);

            this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            boolean createDatabase = DatabaseUtil.createDatabase(connectionString2, hibernateDialect,
                    driverClass, user, pass, generateSampleData);
            this.setCursor(Cursor.getDefaultCursor());

            if (createDatabase) {
                //JOptionPane.showMessageDialog(DatabaseConfigurationView.this, Messages.getString("DatabaseConfigurationDialog.35")); //$NON-NLS-1$
                JOptionPane.showMessageDialog(POSUtil.getBackOfficeWindow(),
                        "Database created. Default password is 1111.\n\nThe system will now restart."); //$NON-NLS-1$

                Main.restart();
            } else {
                JOptionPane.showMessageDialog(POSUtil.getBackOfficeWindow(),
                        Messages.getString("DatabaseConfigurationDialog.36")); //$NON-NLS-1$
            }
        } else if (SAVE.equalsIgnoreCase(command)) {
            Application.getInstance().setSystemInitialized(false);
            saveConfig(selectedDb, providerName, databaseURL, databasePort, databaseName, user, pass,
                    connectionString, hibernateDialect);
        } else if (CANCEL.equalsIgnoreCase(command)) {
        }
    } catch (Exception e2) {
        POSMessageDialog.showMessage(com.floreantpos.util.POSUtil.getBackOfficeWindow(), e2.getMessage());
    }
}

From source file:AlphaTest.java

/**
 * Handle events from the GUI components we created
 */// www . j a  v  a2s.  com
public void actionPerformed(ActionEvent event) {
    if (event.getActionCommand().equals("Update") != false) {
        updateAlpha();
        repaint();
    }
}