Example usage for java.awt.event KeyEvent VK_F3

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

Introduction

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

Prototype

int VK_F3

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

Click Source Link

Document

Constant for the F3 function key.

Usage

From source file:com.pironet.tda.TDA.java

/**
 * initialize the base components needed for the jedit view of the
 * log file/*from   w  ww  .j a v  a 2 s. c  om*/
 */
private void initJeditView() {
    jeditPane = new JEditTextArea();
    jeditPane.setEditable(false);
    jeditPane.setCaretVisible(false);
    jeditPane.setCaretBlinkEnabled(false);
    jeditPane.setRightClickPopup(new PopupMenu(jeditPane, this, runningAsVisualVMPlugin));
    jeditPane.getInputHandler().addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0),
            (ActionListener) jeditPane.getRightClickPopup());
    jeditPane.getInputHandler().addKeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.CTRL_MASK),
            (ActionListener) jeditPane.getRightClickPopup());
    jeditPane.setFont(SANS_SERIF);
}

From source file:com.sshtools.sshterm.emulation.TerminalEmulation.java

public void keyPressed(int keyCode, char keyChar, int modifiers) {
    if (debug > 0) {
        System.out.println("keyPressed(" + keyCode + "," + keyChar + "," + modifiers);
    }/*from  www .j  a v  a  2  s . c  om*/
    boolean control = (modifiers & VDUInput.KEY_CONTROL) != 0;
    boolean shift = (modifiers & VDUInput.KEY_SHIFT) != 0;
    boolean alt = (modifiers & VDUInput.KEY_ALT) != 0;
    int xind;
    String[] fmap;
    xind = 0;
    fmap = FunctionKey;
    if (shift) {
        fmap = FunctionKeyShift;
        xind = 1;
    }
    if (control) {
        fmap = FunctionKeyCtrl;
        xind = 2;
    }
    if (alt) {
        fmap = FunctionKeyAlt;
        xind = 3;
    }
    switch (keyCode) {
    case KeyEvent.VK_PAUSE:
        if (shift || control) {
            sendTelnetCommand((byte) 243);
        }

        // BREAK
        break;
    case KeyEvent.VK_ESCAPE:
        writeSpecial(Escape[xind]);
        break;
    case KeyEvent.VK_F1:
        writeSpecial(fmap[1]);
        break;
    case KeyEvent.VK_F2:
        writeSpecial(fmap[2]);
        break;
    case KeyEvent.VK_F3:
        writeSpecial(fmap[3]);
        break;
    case KeyEvent.VK_F4:
        writeSpecial(fmap[4]);
        break;
    case KeyEvent.VK_F5:
        writeSpecial(fmap[5]);
        break;
    case KeyEvent.VK_F6:
        writeSpecial(fmap[6]);
        break;
    case KeyEvent.VK_F7:
        writeSpecial(fmap[7]);
        break;
    case KeyEvent.VK_F8:
        writeSpecial(fmap[8]);
        break;
    case KeyEvent.VK_F9:
        writeSpecial(fmap[9]);
        break;
    case KeyEvent.VK_F10:
        writeSpecial(fmap[10]);
        break;
    case KeyEvent.VK_F11:
        writeSpecial(fmap[11]);
        break;
    case KeyEvent.VK_F12:
        writeSpecial(fmap[12]);
        break;
    case KeyEvent.VK_UP:
        writeSpecial(KeyUp[xind]);
        break;
    case KeyEvent.VK_DOWN:
        writeSpecial(KeyDown[xind]);
        break;
    case KeyEvent.VK_LEFT:
        writeSpecial(KeyLeft[xind]);
        break;
    case KeyEvent.VK_RIGHT:
        writeSpecial(KeyRight[xind]);
        break;
    case KeyEvent.VK_PAGE_DOWN:
        writeSpecial(NextScn[xind]);
        break;
    case KeyEvent.VK_PAGE_UP:
        writeSpecial(PrevScn[xind]);
        break;
    case KeyEvent.VK_INSERT:
        writeSpecial(Insert[xind]);
        break;
    case KeyEvent.VK_DELETE:
        writeSpecial(Remove[xind]);
        break;
    case KeyEvent.VK_BACK_SPACE:
        writeSpecial(BackSpace[xind]);
        if (localecho) {
            if (BackSpace[xind] == "\b" || BackSpace[xind] == "\u007f") {
                putString("\b \b");
                // make the last char 'deleted'
            } else {
                putString(BackSpace[xind]);
                // echo it
            }
        }
        break;
    case KeyEvent.VK_HOME:
        writeSpecial(KeyHome[xind]);
        break;
    case KeyEvent.VK_END:
        writeSpecial(KeyEnd[xind]);
        break;
    case KeyEvent.VK_NUM_LOCK:
        if (vms && control) {
            writeSpecial(PF1);
        }
        if (!control) {
            numlock = !numlock;
        }
        break;
    case KeyEvent.VK_CAPS_LOCK:
        capslock = !capslock;
        return;
    case KeyEvent.VK_SHIFT:
    case KeyEvent.VK_CONTROL:
    case KeyEvent.VK_ALT:
        return;
    default:
        break;
    }
}

From source file:vista.ventas.DiagOrdenesDeCompra.java

private void eventosDeTeclas() {
    KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    manager.addKeyEventDispatcher(new KeyEventDispatcher() {

        public boolean dispatchKeyEvent(KeyEvent e) {
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow().getClass()
                    .getSimpleName().equals("DiagOrdenesDeCompra")) {
                if (e.getID() == KeyEvent.KEY_PRESSED) {
                    if (e.getKeyCode() == KeyEvent.VK_F3) {
                        agregarArticulo();
                        calcularTotal();
                    }//from w  w w .ja  v  a2  s . c o  m
                    if (e.getKeyCode() == KeyEvent.VK_F7) {
                        realizarVenta();
                    }
                    if (e.getKeyCode() == KeyEvent.VK_F4) {
                        cerrar();
                    }
                    if (e.getKeyCode() == KeyEvent.VK_DELETE && tblArticulos.getSelectedRow() != -1) {
                        quitarArticuloLista();
                    }

                }
            }

            return false;
        }
    });
}

From source file:org.safs.selenium.webdriver.lib.WDLibrary.java

/**
 * Convert a Java KEYCODE to a Selenium WebDriver Keys Enum
 * @param keycode int, a java keycode//from   w  ww . ja  v a2s.  c o  m
 * @return Keys enum for (primarily) non-printable (control) characters, or null.
 */
public static Keys convertToKeys(int keycode) {
    Keys key = null;
    switch (keycode) {
    case java.awt.event.KeyEvent.VK_ADD:
        key = Keys.ADD;
        break;
    case java.awt.event.KeyEvent.VK_ALT:
        key = Keys.ALT;
        break;
    case java.awt.event.KeyEvent.VK_KP_DOWN:
        key = Keys.ARROW_DOWN;
        break;
    case java.awt.event.KeyEvent.VK_KP_LEFT:
        key = Keys.ARROW_LEFT;
        break;
    case java.awt.event.KeyEvent.VK_KP_RIGHT:
        key = Keys.ARROW_RIGHT;
        break;
    case java.awt.event.KeyEvent.VK_KP_UP:
        key = Keys.ARROW_UP;
        break;
    case java.awt.event.KeyEvent.VK_BACK_SPACE:
        key = Keys.BACK_SPACE;
        break;
    case java.awt.event.KeyEvent.VK_CANCEL:
        key = Keys.CANCEL;
        break;
    case java.awt.event.KeyEvent.VK_CLEAR:
        key = Keys.CLEAR;
        break;
    case java.awt.event.KeyEvent.VK_WINDOWS:
        key = Keys.COMMAND;
        break;
    case java.awt.event.KeyEvent.VK_CONTROL:
        key = Keys.CONTROL;
        break;
    case java.awt.event.KeyEvent.VK_DECIMAL:
        key = Keys.DECIMAL;
        break;
    case java.awt.event.KeyEvent.VK_DELETE:
        key = Keys.DELETE;
        break;
    case java.awt.event.KeyEvent.VK_DIVIDE:
        key = Keys.DIVIDE;
        break;
    case java.awt.event.KeyEvent.VK_DOWN:
        key = Keys.DOWN;
        break;
    case java.awt.event.KeyEvent.VK_END:
        key = Keys.END;
        break;
    case java.awt.event.KeyEvent.VK_ENTER:
        key = Keys.ENTER;
        break;
    case java.awt.event.KeyEvent.VK_EQUALS:
        key = Keys.EQUALS;
        break;
    case java.awt.event.KeyEvent.VK_ESCAPE:
        key = Keys.ESCAPE;
        break;
    case java.awt.event.KeyEvent.VK_F1:
        key = Keys.F1;
        break;
    case java.awt.event.KeyEvent.VK_F2:
        key = Keys.F2;
        break;
    case java.awt.event.KeyEvent.VK_F3:
        key = Keys.F3;
        break;
    case java.awt.event.KeyEvent.VK_F4:
        key = Keys.F4;
        break;
    case java.awt.event.KeyEvent.VK_F5:
        key = Keys.F5;
        break;
    case java.awt.event.KeyEvent.VK_F6:
        key = Keys.F6;
        break;
    case java.awt.event.KeyEvent.VK_F7:
        key = Keys.F7;
        break;
    case java.awt.event.KeyEvent.VK_F8:
        key = Keys.F8;
        break;
    case java.awt.event.KeyEvent.VK_F9:
        key = Keys.F9;
        break;
    case java.awt.event.KeyEvent.VK_F10:
        key = Keys.F10;
        break;
    case java.awt.event.KeyEvent.VK_F11:
        key = Keys.F11;
        break;
    case java.awt.event.KeyEvent.VK_F12:
        key = Keys.F12;
        break;
    case java.awt.event.KeyEvent.VK_HELP:
        key = Keys.HELP;
        break;
    case java.awt.event.KeyEvent.VK_HOME:
        key = Keys.HOME;
        break;
    case java.awt.event.KeyEvent.VK_INSERT:
        key = Keys.INSERT;
        break;
    case java.awt.event.KeyEvent.VK_LEFT:
        key = Keys.LEFT;
        break;
    case java.awt.event.KeyEvent.VK_META:
        key = Keys.META;
        break;
    case java.awt.event.KeyEvent.VK_MULTIPLY:
        key = Keys.MULTIPLY;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD0:
        key = Keys.NUMPAD0;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD1:
        key = Keys.NUMPAD1;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD2:
        key = Keys.NUMPAD2;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD3:
        key = Keys.NUMPAD3;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD4:
        key = Keys.NUMPAD4;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD5:
        key = Keys.NUMPAD5;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD6:
        key = Keys.NUMPAD6;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD7:
        key = Keys.NUMPAD7;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD8:
        key = Keys.NUMPAD8;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD9:
        key = Keys.NUMPAD9;
        break;
    case java.awt.event.KeyEvent.VK_PAGE_DOWN:
        key = Keys.PAGE_DOWN;
        break;
    case java.awt.event.KeyEvent.VK_PAGE_UP:
        key = Keys.PAGE_UP;
        break;
    case java.awt.event.KeyEvent.VK_PAUSE:
        key = Keys.PAUSE;
        break;
    case java.awt.event.KeyEvent.VK_RIGHT:
        key = Keys.RIGHT;
        break;
    case java.awt.event.KeyEvent.VK_SEMICOLON:
        key = Keys.SEMICOLON;
        break;
    case java.awt.event.KeyEvent.VK_SEPARATOR:
        key = Keys.SEPARATOR;
        break;
    case java.awt.event.KeyEvent.VK_SHIFT:
        key = Keys.SHIFT;
        break;
    case java.awt.event.KeyEvent.VK_SPACE:
        key = Keys.SPACE;
        break;
    case java.awt.event.KeyEvent.VK_SUBTRACT:
        key = Keys.SUBTRACT;
        break;
    case java.awt.event.KeyEvent.VK_TAB:
        key = Keys.TAB;
        break;
    case java.awt.event.KeyEvent.VK_UP:
        key = Keys.UP;
        break;
    }
    return key;
}

From source file:vista.ventas.DialogEntregas.java

private void eventosDeTeclas() {
    KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
    manager.addKeyEventDispatcher(new KeyEventDispatcher() {
        public boolean dispatchKeyEvent(KeyEvent e) {
            if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow().getClass()
                    .getSimpleName().equals("DialogEntregas")) {
                if (e.getID() == KeyEvent.KEY_PRESSED) {
                    if (e.getKeyCode() == KeyEvent.VK_F3) {
                        agregarArticulo();
                        calcularSubtotalGral();
                    }//w  w w . j a v a2  s . c  om
                    if (e.getKeyCode() == KeyEvent.VK_F7) {
                        realizarVenta();
                    }
                    if (e.getKeyCode() == KeyEvent.VK_F4) {
                        cerrar();
                    }

                }
            }

            return false;
        }
    });
}

From source file:org.nuclos.client.ui.collect.CollectController.java

protected void setupShortcutsForTabs(MainFrameTab ifrm) {
    final Action actSelectSearchTab = new AbstractAction() {

        @Override/*from   w w w. j  a  v a  2  s  . c o  m*/
        public void actionPerformed(ActionEvent ev) {
            if (getCollectPanel().isTabbedPaneEnabledAt(CollectPanel.TAB_SEARCH)) {
                getCollectPanel().setTabbedPaneSelectedComponent(getSearchPanel());
            }
        }
    };

    final Action actSelectResultTab = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent ev) {
            if (getCollectPanel().isTabbedPaneEnabledAt(CollectPanel.TAB_RESULT)) {
                getCollectPanel().setTabbedPaneSelectedComponent(getResultPanel());
            }
        }
    };

    final Action actSelectDetailsTab = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent ev) {
            if (getCollectPanel().isTabbedPaneEnabledAt(CollectPanel.TAB_DETAILS)) {
                getCollectPanel().setTabbedPaneSelectedComponent(getDetailsPanel());
            }
        }
    };

    final String sKeySelectSearchTab = "SelectSearchTab";
    ifrm.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
            .put(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0), sKeySelectSearchTab);
    ifrm.getRootPane().getActionMap().put(sKeySelectSearchTab, actSelectSearchTab);

    final String sKeySelectResultTab = "SelectResultTab";
    ifrm.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
            .put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0), sKeySelectResultTab);
    ifrm.getRootPane().getActionMap().put(sKeySelectResultTab, actSelectResultTab);

    /**
     * inner class SelectTabAction
     */
    class SelectTabAction extends AbstractAction {

        private int iDirection;

        /**
         * @param iDirection -1 for previous tab, +1 for next tab
         */
        SelectTabAction(int iDirection) {
            this.iDirection = iDirection;
        }

        @Override
        public void actionPerformed(ActionEvent ev) {
            int iExternalTabIndex = getCollectPanel().getTabbedPaneSelectedIndex();

            // try to find the next enabled tab in the given direction.
            // If the selected tab is the only enabled tab, do nothing:
            for (int i = 0; i < getCollectPanel().getTabCount() - 1; ++i) {
                int iInternalTabIndex = getCollectPanel().getTabIndexOf(iExternalTabIndex);
                iInternalTabIndex = (iInternalTabIndex + iDirection + getCollectPanel().getTabCount())
                        % getCollectPanel().getTabCount();
                iExternalTabIndex = getCollectPanel().getExternalTabIndexOf(iInternalTabIndex);
                if (getCollectPanel().isTabbedPaneEnabledAt(iExternalTabIndex)) {
                    getCollectPanel().setTabbedPaneSelectedIndex(iExternalTabIndex);
                    break;
                }
            }
        }
    } // inner class SelectTabAction

    final String sKeySelectPreviousTab = "SelectPreviousTab";
    ifrm.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
            .put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.ALT_DOWN_MASK), sKeySelectPreviousTab);
    ifrm.getRootPane().getActionMap().put(sKeySelectPreviousTab, new SelectTabAction(-1));

    final String sKeySelectNextTab = "SelectNextTab";
    ifrm.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
            .put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.ALT_DOWN_MASK), sKeySelectNextTab);
    ifrm.getRootPane().getActionMap().put(sKeySelectNextTab, new SelectTabAction(+1));
}

From source file:br.com.atmatech.sac.view.ViewPessoa.java

private void inicializaAtalhos() {
        //Atalho novo
        KeyStroke keyStrokeJBnovo = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0);
        String actionNameJBnovo = "F1";
        InputMap inputMapJBnovo = jBnovo.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

        inputMapJBnovo.put(keyStrokeJBnovo, actionNameJBnovo);
        ActionMap actionMapJBnovo = jBnovo.getActionMap();
        actionMapJBnovo.put(actionNameJBnovo, acaoJBnovo);

        //Atalho alterar
        KeyStroke keyStrokeJBalterar = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0);
        String actionNameJBalterar = "F3";
        InputMap inputMapJBalterar = jBalterar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

        inputMapJBalterar.put(keyStrokeJBalterar, actionNameJBalterar);
        ActionMap actionMapJBalterar = jBalterar.getActionMap();
        actionMapJBalterar.put(actionNameJBalterar, acaoJBalterar);

        //Atalho salvar
        KeyStroke keyStrokeJBsalvar = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0);
        String actionNameJBsalvar = "F2";
        InputMap inputMapJBsalvar = jBsalvar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

        inputMapJBsalvar.put(keyStrokeJBsalvar, actionNameJBsalvar);
        ActionMap actionMapJBsalvar = jBsalvar.getActionMap();
        actionMapJBsalvar.put(actionNameJBsalvar, acaoJBsalvar);

        //Atalho excluir
        KeyStroke keyStrokeJBexcluir = KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0);
        String actionNameJBexcluir = "F4";
        InputMap inputMapJBexcluir = jBexcluir.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

        inputMapJBexcluir.put(keyStrokeJBexcluir, actionNameJBexcluir);
        ActionMap actionMapJBexcluir = jBexcluir.getActionMap();
        actionMapJBexcluir.put(actionNameJBexcluir, acaoJBexcluir);

        //Atalho cancelar
        //        KeyStroke keyStrokeJBcancelar = KeyStroke.getKeyStroke(KeyEvent.VK_F5,0);
        //        String actionNameJBcancelar = "F5";
        //        InputMap inputMapJBcancelar = jBcancelar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
        ////ww  w  . j a  v a 2  s  . c  o m
        //        inputMapJBcancelar.put(keyStrokeJBcancelar, actionNameJBcancelar);
        //        ActionMap actionMapJBcancelar = jBcancelar.getActionMap();
        //        actionMapJBcancelar.put(actionMapJBcancelar, acaoJBcancelar);
    }