Example usage for java.awt.event KeyEvent KEY_RELEASED

List of usage examples for java.awt.event KeyEvent KEY_RELEASED

Introduction

In this page you can find the example usage for java.awt.event KeyEvent KEY_RELEASED.

Prototype

int KEY_RELEASED

To view the source code for java.awt.event KeyEvent KEY_RELEASED.

Click Source Link

Document

The "key released" event.

Usage

From source file:com.jcraft.weirdx.DDXWindowImp.java

public void processKeyEvent(KeyEvent e) {
    int id = e.getID();
    if (id == KeyEvent.KEY_PRESSED) {
        keyPressed(e);/*  w w  w .ja v a  2  s  . c  om*/
    } else if (id == KeyEvent.KEY_RELEASED) {
        keyReleased(e);
    } else if (id == KeyEvent.KEY_TYPED) {
        keyTyped(e);
    }
    e.consume(); // ??
}

From source file:KeyNavigateTest.java

public void initialize() {
    WakeupCriterion[] keyEvents = new WakeupCriterion[2];
    keyEvents[0] = new WakeupOnAWTEvent(KeyEvent.KEY_PRESSED);
    keyEvents[1] = new WakeupOnAWTEvent(KeyEvent.KEY_RELEASED);
    keyCriterion = new WakeupOr(keyEvents);

    wakeupOn(keyCriterion);/*from   w ww  .ja va 2 s  .com*/
}

From source file:com.peterbochs.PeterBochsDebugger.java

private void initGUI() {
    try {//from   ww w  .ja  v a2s. c  o m
        language = Utf8ResourceBundle.getBundle("language_" + Setting.getInstance().getCurrentLanguage());

        // $hide>>$
        if (os == OSType.win) {
            if (!new File("PauseBochs.exe").exists() || !new File("StopBochs.exe").exists()) {
                JOptionPane.showMessageDialog(null, MyLanguage.getString("PauseBochsExe"),
                        MyLanguage.getString("Error"), JOptionPane.ERROR_MESSAGE);
                System.exit(1);
            }
            if (!new File("ndisasm.exe").exists()) {
                JOptionPane.showMessageDialog(null, MyLanguage.getString("NdisasmExe"),
                        MyLanguage.getString("Error"), JOptionPane.ERROR_MESSAGE);
                System.exit(1);
            }
        }
        // $hide<<$
    } catch (Exception e) {
        e.printStackTrace();
    }

    try {
        {
            this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            if (Global.isBeta) {
                this.setTitle(MyLanguage.getString("Title") + " " + Global.version
                        + " , This is beta version, if you found a bug, please try older official release");
            } else {
                this.setTitle(MyLanguage.getString("Title") + " " + Global.version);
            }

            this.setIconImage(
                    new ImageIcon(getClass().getClassLoader().getResource("com/peterbochs/icons/peter.png"))
                            .getImage());
            this.addWindowListener(new WindowAdapter() {
                public void windowOpened(WindowEvent evt) {
                    thisWindowOpened(evt);
                }

                public void windowActivated(WindowEvent evt) {
                    thisWindowActivated(evt);
                }

                public void windowClosing(WindowEvent evt) {
                    thisWindowClosing(evt);
                }
            });
        }
        {
            jToolBar1 = new JToolBar();
            getContentPane().add(jToolBar1, BorderLayout.NORTH);
            {
                startBochsButton = new JButton();
                jToolBar1.add(startBochsButton);
                startBochsButton.setText(MyLanguage.getString("Start_bochs"));
                startBochsButton.setToolTipText("Launch bochs");
                startBochsButton.setIcon(new ImageIcon(getClass().getClassLoader()
                        .getResource("com/peterbochs/icons/famfam_icons/accept.png")));
                startBochsButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        startBochsButtonActionPerformed(evt);
                    }
                });
            }
            {
                stopBochsButton = new JButton();
                jToolBar1.add(stopBochsButton);
                stopBochsButton.setText(MyLanguage.getString("Stop_bochs"));
                stopBochsButton.setToolTipText("Quit bochs");
                stopBochsButton.setIcon(new ImageIcon(
                        getClass().getClassLoader().getResource("com/peterbochs/icons/famfam_icons/stop.png")));
                stopBochsButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        stopBochsButtonActionPerformed(evt);
                    }
                });
            }
            {
                runBochsButton = new JDropDownButton();
                jToolBar1.add(runBochsButton);
                runBochsButton.setText(MyLanguage.getString("Run_bochs"));
                runBochsButton.setToolTipText("Start emulation");
                runBochsButton.setMaximumSize(new java.awt.Dimension(85, 26));
                runBochsButton.add(getJRunBochsAndSkipBreakpointMenuItem());
                runBochsButton.add(getJRunCustomCommandMenuItem());
                runBochsButton.setIcon(new ImageIcon(getClass().getClassLoader()
                        .getResource("com/peterbochs/icons/famfam_icons/resultset_next.png")));
                runBochsButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        runBochsButtonActionPerformed(evt);
                    }
                });
            }
            {
                stepBochsButton = new JDropDownButton();
                jToolBar1.add(stepBochsButton);
                jToolBar1.add(getJStepOverDropDownButton());
                jToolBar1.add(getJFastStepBochsButton());
                stepBochsButton.setIcon(new ImageIcon(
                        getClass().getClassLoader().getResource("com/peterbochs/icons/famfam_icons/step.png")));
                stepBochsButton.setText(MyLanguage.getString("Step"));
                stepBochsButton.setMaximumSize(new java.awt.Dimension(85, 26));
                stepBochsButton.add(getJStep10MenuItem());
                stepBochsButton.add(getJStep100MenuItem());
                stepBochsButton.add(getJStepNMenuItem());
                stepBochsButton.add(getJStepUntilCallOrJumpMenuItem());
                stepBochsButton.add(getJStepUntilRetMenuItem());
                stepBochsButton.add(getJStepUntilIRetMenuItem());
                stepBochsButton.add(getJStepUntilMovMenuItem());
                stepBochsButton.add(getJStepUntilIPBigChangeMenuItem());
                stepBochsButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        stepBochsButtonActionPerformed(evt);
                    }
                });
            }
            {
                nextButton = new JButton();
                nextButton.setIcon(new ImageIcon(
                        getClass().getClassLoader().getResource("com/peterbochs/icons/famfam_icons/step.png")));
                nextButton.setText(MyLanguage.getString("Nexti"));
                nextButton.setToolTipText("c/c++ level step-in");
                jToolBar1.add(nextButton);
                jToolBar1.add(getNextOverButton());
                nextButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        nextButtonActionPerformed(evt);
                    }
                });
            }
            {
                jUpdateBochsButton = new JButton();
                jToolBar1.add(jUpdateBochsButton);
                jToolBar1.add(getJExportToExcelButton());
                jToolBar1.add(getJSettingButton());
                jToolBar1.add(getJRegisterToggleButton());
                jToolBar1.add(getJSourceLevelDebuggerButton());
                jToolBar1.add(getJProfilerToggleButton());
                jToolBar1.add(getJLogToggleButton());
                jToolBar1.add(getJOSLogToggleButton());
                jUpdateBochsButton.setEnabled(true);
                jUpdateBochsButton.setText(MyLanguage.getString("Update"));
                jUpdateBochsButton.setIcon(new ImageIcon(getClass().getClassLoader()
                        .getResource("com/peterbochs/icons/famfam_icons/arrow_refresh.png")));
                jUpdateBochsButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        jUpdateBochsButtonActionPerformed(evt);
                    }
                });
            }
        }
        {
            jStatusPanel = new JPanel();
            BorderLayout jStatusPanelLayout = new BorderLayout();
            jStatusPanel.setLayout(jStatusPanelLayout);
            getContentPane().add(jStatusPanel, BorderLayout.SOUTH);
            getContentPane().add(getJMainPanel());
            {
                jStatusProgressBar = new JProgressBar();
                jStatusPanel.add(jStatusProgressBar, BorderLayout.WEST);
                jStatusPanel.add(getJPanel25(), BorderLayout.CENTER);
            }
        }
        {
            jMenuBar1 = new JMenuBar();
            setJMenuBar(jMenuBar1);
            {
                jMenu3 = new JMenu();
                jMenuBar1.add(jMenu3);
                jMenu3.setText(MyLanguage.getString("File"));
                {
                    jSeparator2 = new JSeparator();
                    jMenu3.add(jSeparator2);
                }
                {
                    exitMenuItem = new JMenuItem();
                    jMenu3.add(exitMenuItem);
                    exitMenuItem.setText(MyLanguage.getString("Exit"));
                    exitMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            exitMenuItemActionPerformed(evt);
                        }
                    });
                }
            }
            {
                jMenu4 = new JMenu();
                jMenuBar1.add(jMenu4);
                jMenuBar1.add(getJFontMenu());
                jMenuBar1.add(getJMenu6());
                jMenuBar1.add(getJSystemMenu());
                jMenu4.setText(MyLanguage.getString("Bochs"));
                {
                    startBochsMenuItem = new JMenuItem();
                    jMenu4.add(startBochsMenuItem);
                    startBochsMenuItem.setText(MyLanguage.getString("Start_bochs"));
                    startBochsMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            startBochsMenuItemActionPerformed(evt);
                        }
                    });
                }
                {
                    stopBochsMenuItem = new JMenuItem();
                    jMenu4.add(stopBochsMenuItem);
                    stopBochsMenuItem.setText(MyLanguage.getString("Stop_bochs"));
                    stopBochsMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            stopBochsMenuItemActionPerformed(evt);
                        }
                    });
                }
                {
                    jSeparator1 = new JSeparator();
                    jMenu4.add(jSeparator1);
                }
                {
                    runBochsMenuItem = new JMenuItem();
                    jMenu4.add(runBochsMenuItem);
                    runBochsMenuItem.setText(MyLanguage.getString("Run_bochs"));
                    runBochsMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            runBochsMenuItemActionPerformed(evt);
                        }
                    });
                }
                {
                    pauseBochsMenuItem = new JMenuItem();
                    jMenu4.add(pauseBochsMenuItem);
                    pauseBochsMenuItem.setText(MyLanguage.getString("Pause_bochs"));
                    pauseBochsMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            pauseBochsMenuItemActionPerformed(evt);
                        }
                    });
                }
                {
                    jUpdateBochsStatusMenuItem = new JMenuItem();
                    jMenu4.add(jUpdateBochsStatusMenuItem);
                    jUpdateBochsStatusMenuItem.setText(MyLanguage.getString("Update_bochs_status"));
                    jUpdateBochsStatusMenuItem.setBounds(83, 86, 79, 20);
                    jUpdateBochsStatusMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            jUpdateBochsStatusMenuItemActionPerformed(evt);
                        }
                    });
                }
            }
            {
                jMenu5 = new JMenu();
                jMenuBar1.add(jMenu5);
                jMenu5.setText(MyLanguage.getString("Help"));
                {
                    aboutUsMenuItem = new JMenuItem();
                    jMenu5.add(aboutUsMenuItem);
                    jMenu5.add(getJHelpRequestMenuItem());
                    jMenu5.add(getJJVMMenuItem());
                    jMenu5.add(getShortcutHelpMenuItem());
                    jMenu5.add(getJLicenseMenuItem());
                    aboutUsMenuItem.setText(MyLanguage.getString("About_us"));
                    aboutUsMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            aboutUsMenuItemActionPerformed(evt);
                        }
                    });
                }
            }
        }
        if (Setting.getInstance().getWidth() == 0 || Setting.getInstance().getHeight() == 0) {
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            setSize(screenSize.width * 2 / 3, screenSize.height * 4 / 5);
        } else {
            setSize(Setting.getInstance().getWidth(), Setting.getInstance().getHeight());
        }
        int x = Setting.getInstance().getX();
        int y = Setting.getInstance().getY();
        if (x <= 0 || y <= 0) {
            this.setLocationRelativeTo(null);
        } else {
            setLocation(x, y);
        }

        jSplitPane1.setDividerLocation(Setting.getInstance().getDivX());
        jSplitPane2.setDividerLocation(Setting.getInstance().getDivY());

        jOSDebugInformationPanel1.getjMainSplitPane()
                .setDividerLocation(Setting.getInstance().getOsDebugSplitPane_DividerLocation());
        // pack();
        initGlobalFontSetting(new Font(Setting.getInstance().getFontFamily(), Font.PLAIN,
                Setting.getInstance().getFontsize()));
        jInstrumentPanel.setThing(jStatusProgressBar, jStatusLabel);

        // prevent null jmenuitem
        getJInstructionPanelPopupMenu();
        // end prevent null jmenuitem

        KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {
            public boolean dispatchKeyEvent(KeyEvent e) {
                if (e.getID() == KeyEvent.KEY_RELEASED) {
                    int keycode = e.getKeyCode();
                    if (keycode == 112) {
                        jTabbedPane3.setSelectedIndex(0);
                    } else if (keycode == 113) {
                        jTabbedPane3.setSelectedIndex(1);
                    } else if (keycode == 114) {
                        jTabbedPane3.setSelectedIndex(2);
                    } else if (keycode == 115) {
                        jTabbedPane3.setSelectedIndex(3);
                    } else if (keycode == 116) {
                        if (startBochsButton.isEnabled()) {
                            startBochsButtonActionPerformed(null);
                        }
                    } else if (keycode == 117) {
                        if (stopBochsButton.isEnabled()) {
                            stopBochsButtonActionPerformed(null);
                        }
                    } else if (keycode == 118) {
                        if (runBochsButton.isEnabled()) {
                            runBochsButtonActionPerformed(null);
                        }
                    } else if (keycode == 119) {
                        if (stepBochsButton.isEnabled()) {
                            stepBochsButtonActionPerformed(null);
                        }
                    } else if (keycode == 120) {
                        if (fastStepBochsButton.isEnabled()) {
                            fastStepButtonActionPerformed(null);
                        }
                    }
                }

                // If the key should not be dispatched to the
                // focused component, set discardEvent to true
                boolean discardEvent = false;
                return discardEvent;
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(ERROR);
    }
}

From source file:org.eclipse.jubula.rc.swing.driver.RobotAwtImpl.java

/**
 * {@inheritDoc}// ww  w . j a  va 2s. c o m
 */
public void type(Object graphicsComponent, char character) throws RobotException {

    Validate.notNull(graphicsComponent, "The graphic component must not be null"); //$NON-NLS-1$
    try {
        int modifier = 0;
        Component component = (Component) graphicsComponent;
        KeyEvent ke = new KeyEvent(component, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), modifier,
                KeyEvent.VK_UNDEFINED, character);
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ke);
        ke = new KeyEvent(component, KeyEvent.KEY_TYPED, System.currentTimeMillis(), modifier,
                KeyEvent.VK_UNDEFINED, character);
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ke);
        IRobotEventConfirmer confirmer = m_interceptor
                .intercept(new InterceptorOptions(new long[] { AWTEvent.KEY_EVENT_MASK }));
        ke = new KeyEvent(component, KeyEvent.KEY_RELEASED, System.currentTimeMillis(), modifier,
                KeyEvent.VK_UNDEFINED, character);
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ke);
        confirmer.waitToConfirm(component, new DefaultAwtEventMatcher(KeyEvent.KEY_RELEASED));
    } catch (AWTError awte) {
        log.error(awte);
        throw new RobotException(awte);
    } catch (SecurityException se) {
        log.error(se);
        throw new RobotException(se);
    }
}

From source file:org.eclipse.jubula.rc.swing.driver.RobotAwtImpl.java

/**
 * {@inheritDoc}/* ww w . j av a 2  s .co m*/
 */
public void keyType(Object graphicsComponent, int keycode) throws RobotException {
    try {
        InterceptorOptions options = new InterceptorOptions(new long[] { AWTEvent.KEY_EVENT_MASK });
        IRobotEventConfirmer confirmer = m_interceptor.intercept(options);
        try {
            m_robot.keyPress(keycode);
            m_eventFlusher.flush();
        } finally {
            m_robot.keyRelease(keycode);
            m_eventFlusher.flush();
        }
        confirmer.waitToConfirm(graphicsComponent, new KeyAwtEventMatcher(KeyEvent.KEY_RELEASED));
    } catch (IllegalArgumentException e) {
        throw new RobotException(e);
    }
}

From source file:org.eclipse.jubula.rc.swing.driver.RobotAwtImpl.java

/**
 * Implements the key press or release. 
 * @param graphicsComponent The component, may be <code>null</code>
 * @param keyCode  The key code/*from w ww  .  j  av  a2s .  c o  m*/
 * @param press If <code>true</code>, the key is pressed, otherwise released
 */
private void keyPressReleaseImpl(Object graphicsComponent, int keyCode, boolean press) {

    InterceptorOptions options = new InterceptorOptions(new long[] { AWTEvent.KEY_EVENT_MASK });
    IRobotEventConfirmer confirmer = m_interceptor.intercept(options);
    if (press) {
        m_robot.keyPress(keyCode);
        m_eventFlusher.flush();
    } else {
        m_robot.keyRelease(keyCode);
        m_eventFlusher.flush();
    }
    confirmer.waitToConfirm(graphicsComponent,
            new KeyAwtEventMatcher(press ? KeyEvent.KEY_PRESSED : KeyEvent.KEY_RELEASED));
}

From source file:org.wings.plaf.css.FrameCG.java

private void appendStrokes(StringBuilder builder, SComponent component, int condition, InputMap inputMap) {
    KeyStroke[] keyStrokes = inputMap.keys();
    if (keyStrokes != null) {
        for (int i = 0; i < keyStrokes.length; i++) {
            KeyStroke keyStroke = keyStrokes[i];
            Object binding = inputMap.get(keyStroke);

            switch (keyStroke.getKeyEventType()) {
            case KeyEvent.KEY_PRESSED:
                builder.append("kss.push(new ks('");
                builder.append(component.getName());
                builder.append("',");
                builder.append(/*ww w.  j a v  a2s. co m*/
                        condition == SComponent.WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT ? "!0" : "!1");
                builder.append(",'");
                builder.append(binding);
                builder.append("',");
                builder.append(keyStroke.getKeyCode());
                builder.append(',');
                builder.append((keyStroke.getModifiers() & InputEvent.SHIFT_DOWN_MASK) != 0 ? "!0" : "!1");
                builder.append(',');
                builder.append((keyStroke.getModifiers() & InputEvent.CTRL_DOWN_MASK) != 0 ? "!0" : "!1");
                builder.append(',');
                builder.append((keyStroke.getModifiers() & InputEvent.ALT_DOWN_MASK) != 0 ? "!0" : "!1");
                builder.append("));\n");
                break;
            case KeyEvent.KEY_TYPED:
                break;
            case KeyEvent.KEY_RELEASED:
                break;
            }
        }
    }
}

From source file:org.wings.plaf.css.InputMapScriptListener.java

public static void install(SComponent component) {
    ScriptListener[] scriptListeners = component.getScriptListeners();

    for (int i = 0; i < scriptListeners.length; i++) {
        ScriptListener scriptListener = scriptListeners[i];
        if (scriptListener instanceof InputMapScriptListener)
            component.removeScriptListener(scriptListener);
    }//from   w  w w  .  j  a va  2  s  .  c  o  m

    InputMap inputMap = component.getInputMap();
    if (inputMap.size() == 0)
        return; // we're done

    StringBuffer pressed = new StringBuffer();
    StringBuffer typed = new StringBuffer();
    StringBuffer released = new StringBuffer();
    KeyStroke[] keyStrokes = inputMap.keys();

    for (int i = 0; i < keyStrokes.length; i++) {
        KeyStroke keyStroke = keyStrokes[i];
        Object binding = inputMap.get(keyStroke);

        /*
        writeMatch(typed, keyStroke);
        writeRequest(typed, binding);
        */

        switch (keyStroke.getKeyEventType()) {
        case KeyEvent.KEY_PRESSED:
            writeMatch(pressed, keyStroke);
            writeRequest(pressed, binding);
            break;
        case KeyEvent.KEY_TYPED:
            writeMatch(typed, keyStroke);
            writeRequest(typed, binding);
            log.debug("typed binding = " + binding);
            break;
        case KeyEvent.KEY_RELEASED:
            writeMatch(released, keyStroke);
            writeRequest(released, binding);
            log.debug("released binding = " + binding);
            break;
        }
    }

    if (pressed.length() > 0)
        component.addScriptListener(
                new InputMapScriptListener("onkeydown", "return pressed_" + component.getName() + "(event)",
                        "function pressed_" + component.getName() + "(event) {\n  "
                                + "event = getEvent(event);\n  " + pressed.toString() + "  return true;\n}\n"));
    if (typed.length() > 0)
        component.addScriptListener(
                new InputMapScriptListener("onkeypress", "return typed_" + component.getName() + "(event)",
                        "function typed_" + component.getName() + "(event) {\n  "
                                + "event = getEvent(event);\n  " + typed.toString() + "  return true;\n}\n"));
    if (released.length() > 0)
        component.addScriptListener(
                new InputMapScriptListener("onkeyup", "return released_" + component.getName() + "(event)",
                        "function released_" + component.getName() + "(event) {\n"
                                + "event = getEvent(event);\n  " + released.toString()
                                + "  return true;\n}\n"));
}

From source file:org.wings.plaf.css.InputMapScriptListener.java

public static void installToFrame(SFrame frame, SComponent component) {

    InputMap inputMap = component.getInputMap(SComponent.WHEN_IN_FOCUSED_FRAME);

    StringBuffer pressed = new StringBuffer();
    StringBuffer typed = new StringBuffer();
    StringBuffer released = new StringBuffer();
    KeyStroke[] keyStrokes = inputMap.keys();

    for (int i = 0; i < keyStrokes.length; i++) {
        KeyStroke keyStroke = keyStrokes[i];
        Object binding = inputMap.get(keyStroke);

        /*//from   w ww . java  2s. c o  m
        writeMatch(typed, keyStroke);
        writeRequest(typed, binding);
        */

        switch (keyStroke.getKeyEventType()) {
        case KeyEvent.KEY_PRESSED:
            writeMatch(pressed, keyStroke);
            writeRequestForFrame(pressed, binding, component.getName());
            break;
        case KeyEvent.KEY_TYPED:
            writeMatch(typed, keyStroke);
            writeRequestForFrame(typed, binding, component.getName());
            log.debug("typed binding = " + binding);
            break;
        case KeyEvent.KEY_RELEASED:
            writeMatch(released, keyStroke);
            writeRequestForFrame(released, binding, component.getName());
            log.debug("released binding = " + binding);
            break;
        }
    }

    if (pressed.length() > 0)
        frame.addScriptListener(
                new InputMapScriptListener("onkeydown", "pressed_frame_" + component.getName() + "(event)",
                        "function pressed_frame_" + component.getName() + "(event) {\n  "
                                + "event = getEvent(event);\n  " + pressed.toString() + "  return true;\n}\n"));
    if (typed.length() > 0)
        frame.addScriptListener(
                new InputMapScriptListener("onkeypress", "typed_frame_" + component.getName() + "(event)",
                        "function typed_frame_" + component.getName() + "(event) {\n  "
                                + "event = getEvent(event);\n  " + typed.toString() + "  return true;\n}\n"));
    if (released.length() > 0)
        frame.addScriptListener(
                new InputMapScriptListener("onkeyup", "released_frame_" + component.getName() + "(event)",
                        "function released_frame_" + component.getName() + "(event) {\n"
                                + "event = getEvent(event);\n  " + released.toString()
                                + "  return true;\n}\n"));
}

From source file:thesaurusEditor.gui.graph.MainGraph.java

public void keyEventHappened(KeyEvent e) {
    if (e.getID() == KeyEvent.KEY_PRESSED) {
        graphMouse.getModeKeyListener().keyPressed(e);
    }/*from  w w w.  j av a2  s.  c  o  m*/
    if (e.getID() == KeyEvent.KEY_RELEASED) {
        graphMouse.getModeKeyListener().keyReleased(e);
        ;
    }
}