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.ParametricModelPropertySheetPanel.java

private void jtfNameActionListener(java.awt.event.ActionEvent evt) {
    String command = evt.getActionCommand();
    logger.log(Level.INFO, "ComponentSheet jtfNameActionListener fired");
    try {// w  w  w . j a  va  2s.  c  o  m
        BeanProxy proxy = new BeanProxy(this.target);
        proxy.set("name", evt.getActionCommand());
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "{0}", stack);
    }
}

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

private void jtfDescriptionActionListener(java.awt.event.ActionEvent evt) {
    String command = evt.getActionCommand();
    logger.log(Level.ALL, "ComponentSheet jtfDescriptionActionListener fired {0}", command);
    try {//from w  ww .  jav a2  s .  c  o  m
        BeanProxy proxy = new BeanProxy(this.target);
        proxy.set("description", evt.getActionCommand());
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "{0}", stack);
    }

}

From source file:temp1.RealTimeChart.java

@Override
public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("EXIT")) {
        thread1.interrupt();/*from   ww  w.  j a v  a2 s  .co m*/
        System.exit(0);
    }
}

From source file:com.alvermont.javascript.tools.shell.ShellJSConsole.java

public void actionPerformed(ActionEvent e) {
    final String cmd = e.getActionCommand();

    if (cmd.equals("Load")) {
        String f = chooseFile();//from  ww  w.ja v  a 2  s  .co m

        if (f != null) {
            f = f.replace('\\', '/');
            this.consoleTextArea.eval("load(\"" + f + "\");");
        }
    } else if (cmd.equals("Close")) {
        log.debug("Closing shell");

        setVisible(false);
    } else if (cmd.equals("Cut")) {
        this.consoleTextArea.cut();
    } else if (cmd.equals("Copy")) {
        this.consoleTextArea.copy();
    } else if (cmd.equals("Paste")) {
        this.consoleTextArea.paste();
    } else {
        // add new commands here
        log.debug("Unexpected actionPerformed() : " + cmd);
    }
}

From source file:MDIApp.java

private MenuBar createMenuBar() {
    ActionListener al = new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            String command = ae.getActionCommand();
            if (command.equals("Open")) {
                if (fd == null) {
                    fd = new FileDialog(MDIApp.this, "Open File", FileDialog.LOAD);
                    fd.setDirectory("/movies");
                }//from  w  ww .j  a v  a  2 s.c o  m
                fd.show();
                if (fd.getFile() != null) {
                    String filename = fd.getDirectory() + fd.getFile();
                    openFile("file:" + filename);
                }
            } else if (command.equals("Exit")) {
                dispose();
                System.exit(0);
            }
        }
    };

    MenuItem item;
    MenuBar mb = new MenuBar();
    // File Menu
    Menu mnFile = new Menu("File");
    mnFile.add(item = new MenuItem("Open"));
    item.addActionListener(al);
    mnFile.add(item = new MenuItem("Exit"));
    item.addActionListener(al);

    // Options Menu 
    Menu mnOptions = new Menu("Options");
    cbAutoLoop = new CheckboxMenuItem("Auto replay");
    cbAutoLoop.setState(true);
    mnOptions.add(cbAutoLoop);

    mb.add(mnFile);
    mb.add(mnOptions);
    return mb;
}

From source file:edu.gcsc.vrl.jfreechart.JFXPlotContainerType.java

protected void updateChartPanel(Container container, final JFreeChart jFreeChart) {

    if (chartPanel != null) {
        chartContainer.remove(chartPanel);
    }/* ww w . ja v  a2 s.  c om*/

    chartPanel = new ChartPanel(jFreeChart);
    chartContainer.add(chartPanel);

    JPopupMenu menu = chartPanel.getPopupMenu();

    menu.addSeparator();
    JMenuItem item1 = new JMenuItem("Export");
    item1.setActionCommand("export_chart");
    item1.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {

            String cmd = e.getActionCommand();

            if (cmd.equals("export_chart")) {

                try {
                    new JFExport().openExportDialog(jFreeChart);
                } catch (Exception e1) {
                    e1.printStackTrace(System.err);
                }

            }
        }
    });
    menu.add(item1);

    revalidate();
}

From source file:it.unibas.spicygui.controllo.provider.composition.MyPopupProviderWidgetChainComposition.java

public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals(SET_ROOT)) {
    } else if (e.getActionCommand().equals(DELETE)) {
        deleteWidget();/*from   ww  w.j  a  v  a 2s .  c  om*/
    } else {
        loadDataSource();

    }
}

From source file:Data.c_PriceDB.java

public void actionPerformed(ActionEvent e) {
    String line = e.getActionCommand();
    if (e.getID() == Action.ACTION_PRICES_LOAD_LINE) {
        if (parsedFirstListPrices == false) {
            parsedFirstListPrices = true;
            m_loadingListener.actionPerformed(e);
            return;
        }/*  w ww.j a  va2  s  . c om*/

        String ary[] = line.split("\\|");
        c_PriceEntry entry;
        c_Price price;
        Double low, avg, high;
        String name, expansion, temp;

        /* Card|Price|StdDev|Average|High|Low|Change|Raw N
           AEther Figment|0.25|0.00|0.25|0.25|0.25|0.00|4
           AEther Flash (6th)|0.36|0.00|0.36|0.36|0.36|0.00|1 */
        temp = ary[PricesParsing.NAME.val];
        if (temp.endsWith(")")) {
            expansion = str.middleOf("(", temp, ")");
            name = str.leftOf(temp, " (");

            if (m_expansionDB.contains(Acronym.Trader, expansion)) {
                expansion = m_expansionDB.getExpansion(Acronym.Trader, expansion).getName();
            } else {
                expansion = "";
            }
        } else {
            expansion = "";
            name = temp;
        }

        avg = Double.parseDouble(ary[PricesParsing.AVERAGE.val]);
        high = Double.parseDouble(ary[PricesParsing.HIGH.val]);
        low = Double.parseDouble(ary[PricesParsing.LOW.val]);
        price = new c_Price(low, avg, high, PriceType.AVERAGE);

        if (!contains(name)) {
            entry = new c_PriceEntry();
            entry.addPriceEntry(price, expansion);
            m_prices.put(name, entry);
        } else {
            entry = m_prices.get(name);
            entry.addPriceEntry(price, expansion);
        }

        m_loadingListener.actionPerformed(e);
        ary = null;
        entry = null;
        price = null;
        name = null;
        expansion = null;
        temp = null;
    } else {
        m_loadingListener.actionPerformed(e);
    }

    line = null;
}

From source file:DynamicTreeDemo.java

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

    if (ADD_COMMAND.equals(command)) {
        // Add button clicked
        treePanel.addObject("New Node " + newNodeSuffix++);
    } else if (REMOVE_COMMAND.equals(command)) {
        // Remove button clicked
        treePanel.removeCurrentNode();/*  w  ww . java  2 s . c o  m*/
    } else if (CLEAR_COMMAND.equals(command)) {
        // Clear button clicked.
        treePanel.clear();
    }
}

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

private void jtfConditionActionListener(java.awt.event.ActionEvent evt) {
    String command = evt.getActionCommand();
    logger.log(Level.INFO, "AssemblySheet jtfDescriptionActionListener fired {0}", command);
    try {//from w w  w  . ja v a2  s. c o m
        BeanProxy proxy = new BeanProxy(this.target);
        proxy.set("description", evt.getActionCommand());
    } catch (IntrospectionException ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "{0}", stack);
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "{0}", stack);
    }
}