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

private void jtfNameActionListener(java.awt.event.ActionEvent evt) {
    String command = evt.getActionCommand();
    logger.log(Level.INFO, "AssemblySheet jtfNameActionListener fired {0}", command);
    try {//from ww w.ja  v a 2s  . c  om
        BeanProxy proxy = new BeanProxy(this.target);
        proxy.set("name", 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);
    }
}

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

private void jtfDescriptionActionListener(java.awt.event.ActionEvent evt) {
    String command = evt.getActionCommand();
    logger.log(Level.INFO, "ScenarioSheet jtfDescriptionInputMethodTextChanged fired {0}", command);
    try {/*from ww w .j a v a2s  . com*/
        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:ca.sfu.federation.viewer.propertysheet.ScenarioPropertySheet.java

private void jtfNameActionListener(java.awt.event.ActionEvent evt) {
    String command = evt.getActionCommand();
    logger.log(Level.INFO, "ScenarioSheet jtfDescriptionInputMethodTextChanged fired {0}", command);
    try {/*from   ww  w. j  a v a2s .c om*/
        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:it.unibas.spicygui.controllo.provider.MyPopupSceneMatcher.java

public void actionPerformed(ActionEvent e) {
    LayerWidget constraintsLayer = myGraphScene.getConstraintsLayer();
    if (e.getActionCommand().equals(Costanti.ACTION_SLIDER)) {
        showSlider(constraintsLayer);//  w ww . j av a 2  s.c  om
    } else {
        StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(Costanti.class, Costanti.GENERIC_ERROR));
    }
}

From source file:TableDialogEditDemo.java

/**
 * Handles events from the editor button and from
 * the dialog's OK button./*  www.  j  a  v  a2s  . c  om*/
 */
public void actionPerformed(ActionEvent e) {
    if (EDIT.equals(e.getActionCommand())) {
        //The user has clicked the cell, so
        //bring up the dialog.
        button.setBackground(currentColor);
        colorChooser.setColor(currentColor);
        dialog.setVisible(true);

        //Make the renderer reappear.
        fireEditingStopped();

    } else { //User pressed dialog's "OK" button.
        currentColor = colorChooser.getColor();
    }
}

From source file:com.sec.ose.osi.ui.frm.main.identification.common.JComboLicenseName.java

public JComboLicenseName() {
    final JTextField editor;
    this.initLicenseComboBox();

    this.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (isEnabled()) {
                if (e.getActionCommand().equals("comboBoxChanged")
                        || e.getActionCommand().equals("comboBoxEdited")) {
                    if (getSelectedIndex() > 0) {
                        setSelectedIndex(getSelectedIndex());
                        IdentifyMediator.getInstance()
                                .setSelectedLicenseName(String.valueOf(getSelectedItem()));
                        log.debug("selected license name : "
                                + IdentifyMediator.getInstance().getSelectedLicenseName());
                    } else {
                        IdentifyMediator.getInstance().setSelectedLicenseName("");
                    }//from ww  w .j av a2 s  . c o m
                }
            }
        }
    });
    editor = (JTextField) this.getEditor().getEditorComponent();
    editor.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
            char ch = e.getKeyChar();

            if (ch != KeyEvent.VK_ENTER && ch != KeyEvent.VK_BACK_SPACE
                    && (ch == KeyEvent.CHAR_UNDEFINED || Character.isISOControl(ch)))
                return;
            if (ch == KeyEvent.VK_ENTER) {
                hidePopup();
                return;
            }

            String str = editor.getText();

            if (getComponentCount() > 0) {
                removeAllItems();
            }

            addItem(str);
            try {
                String tmpLicense = null;
                ArrayList<String> AllLicenseList = new ArrayList<String>();
                AllLicenseList = LicenseAPIWrapper.getAllLicenseList();
                if (str.length() > 0) {
                    for (int i = 0; i < AllLicenseList.size(); i++) {
                        tmpLicense = AllLicenseList.get(i);
                        if (tmpLicense.toLowerCase().startsWith(str.toLowerCase()))
                            addItem(tmpLicense);
                    }
                } else {
                    for (int i = 0; i < AllLicenseList.size(); i++) {
                        addItem(AllLicenseList.get(i));
                    }
                }
            } catch (Exception e1) {
                log.warn(e1.getMessage());
            }

            hidePopup();
            if (str.length() > 0)
                showPopup();
        }
    });

    editor.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            if (editor.getText().length() > 0)
                showPopup();
        }

        public void focusLost(FocusEvent e) {
            hidePopup();
        }
    });
}

From source file:cz.lidinsky.editor.TableCellEditor.java

/**
 *  Only for color chooser/*from w ww. jav a 2 s.  c  om*/
 */
public void actionPerformed(ActionEvent e) {
    if ("edit".equals(e.getActionCommand())) {
        button.setBackground(currentColor);
        colorChooser.setColor(currentColor);
        dialog.setVisible(true);
        fireEditingStopped();
    } else
        currentColor = colorChooser.getColor();
}

From source file:components.TableSelectionDemo.java

public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    //Cell selection is disabled in Multiple Interval Selection
    //mode. The enabled state of cellCheck is a convenient flag
    //for this status.
    if ("Row Selection" == command) {
        table.setRowSelectionAllowed(rowCheck.isSelected());
        //In MIS mode, column selection allowed must be the
        //opposite of row selection allowed.
        if (!cellCheck.isEnabled()) {
            table.setColumnSelectionAllowed(!rowCheck.isSelected());
        }/*from w ww .  j a va 2 s  . c om*/
    } else if ("Column Selection" == command) {
        table.setColumnSelectionAllowed(columnCheck.isSelected());
        //In MIS mode, row selection allowed must be the
        //opposite of column selection allowed.
        if (!cellCheck.isEnabled()) {
            table.setRowSelectionAllowed(!columnCheck.isSelected());
        }
    } else if ("Cell Selection" == command) {
        table.setCellSelectionEnabled(cellCheck.isSelected());
    } else if ("Multiple Interval Selection" == command) {
        table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        //If cell selection is on, turn it off.
        if (cellCheck.isSelected()) {
            cellCheck.setSelected(false);
            table.setCellSelectionEnabled(false);
        }
        //And don't let it be turned back on.
        cellCheck.setEnabled(false);
    } else if ("Single Interval Selection" == command) {
        table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
        //Cell selection is ok in this mode.
        cellCheck.setEnabled(true);
    } else if ("Single Selection" == command) {
        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        //Cell selection is ok in this mode.
        cellCheck.setEnabled(true);
    }

    //Update checkboxes to reflect selection mode side effects.
    rowCheck.setSelected(table.getRowSelectionAllowed());
    columnCheck.setSelected(table.getColumnSelectionAllowed());
    if (cellCheck.isEnabled()) {
        cellCheck.setSelected(table.getCellSelectionEnabled());
    }
}

From source file:TreeUtil.java

public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    int idx = cmd.indexOf('.');
    cmd = cmd.substring(++idx, cmd.length());
    fireActionEvent(new ActionEvent(this, MENU, cmd));
}

From source file:CompassButtons.java

public void actionPerformed(ActionEvent ae) {
    Dimension dv = viewport.getViewSize();
    Dimension de = viewport.getExtentSize();
    String command = ae.getActionCommand();
    if (command == NORTH) {
        if (p.y > 9) {
            p.y -= 10;/*from   ww  w.  j a  va2  s  . co  m*/
        }
    } else if (command == SOUTH) {
        if (p.y + de.height < dv.height) {
            p.y += 10;
        }
    } else if (command == EAST) {
        if (p.x + de.width < dv.width) {
            p.x += 10;
        }
    } else if (command == WEST) {
        if (p.x > 9) {
            p.x -= 10;
        }
    }
    viewport.setViewPosition(p);
}