Example usage for java.awt.event ActionEvent ACTION_FIRST

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

Introduction

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

Prototype

int ACTION_FIRST

To view the source code for java.awt.event ActionEvent ACTION_FIRST.

Click Source Link

Document

The first number in the range of ids used for action events.

Usage

From source file:Main.java

public KeyTextComponent() {
    setBackground(Color.CYAN);/* ww  w  .j  ava2s .co  m*/
    KeyListener internalKeyListener = new KeyAdapter() {
        public void keyPressed(KeyEvent keyEvent) {
            if (actionListenerList != null) {
                int keyCode = keyEvent.getKeyCode();
                String keyText = KeyEvent.getKeyText(keyCode);
                ActionEvent actionEvent = new ActionEvent(this, ActionEvent.ACTION_FIRST, keyText);
                fireActionPerformed(actionEvent);
            }
        }
    };

    MouseListener internalMouseListener = new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            requestFocusInWindow();
        }
    };

    addKeyListener(internalKeyListener);
    addMouseListener(internalMouseListener);
}

From source file:Main.java

public KeyTextComponent() {
    setBackground(Color.CYAN);//from   ww  w . j  a v a  2s  . c  o  m
    KeyListener internalKeyListener = new KeyAdapter() {
        public void keyPressed(KeyEvent keyEvent) {
            if (actionListenerList != null) {
                int keyCode = keyEvent.getKeyCode();
                String keyText = KeyEvent.getKeyText(keyCode);
                ActionEvent actionEvent = new ActionEvent(this, ActionEvent.ACTION_FIRST, keyText,
                        ActionEvent.ALT_MASK);
                fireActionPerformed(actionEvent);
            }
        }
    };

    MouseListener internalMouseListener = new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            requestFocusInWindow();
        }
    };

    addKeyListener(internalKeyListener);
    addMouseListener(internalMouseListener);
}

From source file:Main.java

public KeyTextComponent() {
    setBackground(Color.CYAN);// w w w  .  j  a v  a 2s  .co  m
    KeyListener internalKeyListener = new KeyAdapter() {
        public void keyPressed(KeyEvent keyEvent) {
            if (actionListenerList != null) {
                int keyCode = keyEvent.getKeyCode();
                String keyText = KeyEvent.getKeyText(keyCode);
                ActionEvent actionEvent = new ActionEvent(this, ActionEvent.ACTION_FIRST, keyText,
                        System.currentTimeMillis() - 10, ActionEvent.ALT_MASK);
                fireActionPerformed(actionEvent);
            }
        }
    };

    MouseListener internalMouseListener = new MouseAdapter() {
        public void mousePressed(MouseEvent mouseEvent) {
            requestFocusInWindow();
        }
    };

    addKeyListener(internalKeyListener);
    addMouseListener(internalMouseListener);
}

From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java

/**
 * Wenn ein element meint, was zu melden...
 *//* www.  jav a  2 s  .  c  om*/
@Override
public void actionPerformed(ActionEvent ev) {
    if (ignoreAction)
        return;
    // /////////////////////////////////////////////////////////////////////////
    // Meine Actions
    if (ev.getID() > ActionEvent.ACTION_FIRST) {
        processMessageActions(ev);
        return;
    }
    // /////////////////////////////////////////////////////////////////////////
    // MEN
    else if (ev.getSource() instanceof JMenuItem) {
        processMenuActions(ev);
        return;
    }
    // /////////////////////////////////////////////////////////////////////////
    // Button
    else if (ev.getSource() instanceof JButton) {
        processButtonActions(ev);
        return;
    }
    // /////////////////////////////////////////////////////////////////////////
    // Combobox
    else if (ev.getSource() instanceof JComboBox) {
        processComboBoxActions(ev);
        return;
    }
}

From source file:org.executequery.gui.editor.ManageShortcutsPanel.java

private ActionEvent actionEventForEdit() {
    return new ActionEvent(list, ActionEvent.ACTION_FIRST, null);
}

From source file:org.kepler.gui.popups.LibraryPopupListener.java

/** Handle a double-click action. */
private void handleDoubleClickOutsideKar(TreePath selPath, MouseEvent event) {
    Object ob = selPath.getLastPathComponent();

    if (ob instanceof EntityLibrary) {
        return;//  www.  ja v  a2 s . com
    } else {

        int liid = LibraryManager.getLiidFor((ComponentEntity) ob);
        LibItem li = null;
        try {
            li = LibraryManager.getInstance().getPopulatedLibItem(liid);
        } catch (SQLException e) {
            MessageHandler.error("Error accessinc library item.", e);
            return;
        }

        // open it if it's a MoML
        String filePath = li.getAttributeValue(LibIndex.ATT_XMLFILE);
        if (filePath != null) {
            Component component = _aptree.getParentComponent();
            while (component != null && !(component instanceof TableauFrame)) {
                component = component.getParent();
            }
            if (component == null) {
                MessageHandler.error("Could not find TableauFrame.");
                return;
            }
            Configuration configuration = ((TableauFrame) component).getConfiguration();
            try {
                URL url = new File(filePath).toURI().toURL();
                configuration.openModel(url, url, url.toExternalForm());
            } catch (Exception e) {
                MessageHandler.error("Error opening " + filePath, e);
            }

            // if we successfully opened a file, update the history menu and
            // set the last directory.

            // update the history menu
            if (component instanceof KeplerGraphFrame) {
                try {
                    ((KeplerGraphFrame) component).updateHistory(filePath);
                } catch (IOException exception) {
                    MessageHandler.error("Unable to update history menu.", exception);
                }
            }
            if (component instanceof BasicGraphFrame) {
                ((BasicGraphFrame) component).setLastDirectory(new File(filePath).getParentFile());
            }

        } else if (li.getLsid() != null) {
            // if it has an lsid, show the documentation
            Component component = _aptree.getParentComponent();
            while (component != null && !(component instanceof PtolemyFrame)) {
                component = component.getParent();
            }
            if (component == null) {
                MessageHandler.error("Could not find TableauFrame.");
                return;
            }
            ShowDocumentationAction action = new ShowDocumentationAction(selPath, _aptree.getParentComponent());
            action.setLsidToView(li.getLsid());
            action.setPtolemyFrame((PtolemyFrame) component);

            action.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_FIRST, "open"));
        }
    }
}