Example usage for java.awt.event KeyEvent VK_DOWN

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

Introduction

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

Prototype

int VK_DOWN

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

Click Source Link

Document

Constant for the non-numpad down arrow key.

Usage

From source file:view.MainWindow.java

@Override
public boolean dispatchKeyEvent(KeyEvent e) {
    if (e.getID() == KeyEvent.KEY_PRESSED) {
        if (e.isControlDown()) {
            if (e.getKeyCode() == KeyEvent.VK_W) {
                closeDocument(true);/*from   w  ww  . j  a  va2  s .c o m*/
            } else if (e.getKeyCode() == KeyEvent.VK_ADD) {
                workspacePanel.zoomIn();
            } else if (e.getKeyCode() == KeyEvent.VK_SUBTRACT) {
                workspacePanel.zoomOut();
            } else if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_RIGHT) {
                workspacePanel.pageUp();
            } else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_LEFT) {
                workspacePanel.pageDown();
            }
            if (e.isShiftDown()) {
                if (e.getKeyCode() == KeyEvent.VK_S) {
                    workspacePanel.changeCard(WorkspacePanel.CardEnum.SIGN_PANEL, true);
                } else if (e.getKeyCode() == KeyEvent.VK_V) {
                    workspacePanel.changeCard(WorkspacePanel.CardEnum.VALIDATE_PANEL, true);
                }
            }
        }
    } else if (e.getID() == KeyEvent.KEY_RELEASED) {
    } else if (e.getID() == KeyEvent.KEY_TYPED) {
    }
    return false;
}

From source file:savant.view.swing.Savant.java

private void initMenu() {
    loadGenomeItem.setAccelerator(// ww  w.j a va  2s .  c om
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, MiscUtils.MENU_MASK));
    loadFromFileItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, MiscUtils.MENU_MASK));
    loadFromURLItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, MiscUtils.MENU_MASK));
    loadFromDataSourcePluginItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, MiscUtils.MENU_MASK));
    openProjectItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, MiscUtils.MENU_MASK));
    saveProjectItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, MiscUtils.MENU_MASK));
    saveProjectAsItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    formatItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, MiscUtils.MENU_MASK));
    exitItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, MiscUtils.MENU_MASK));
    undoItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, MiscUtils.MENU_MASK));
    redoItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Y, MiscUtils.MENU_MASK));
    bookmarkItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, MiscUtils.MENU_MASK));
    navigationItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R,
            java.awt.event.InputEvent.SHIFT_MASK | MiscUtils.MENU_MASK));
    panLeftItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_LEFT,
            java.awt.event.InputEvent.SHIFT_MASK));
    panRightItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_RIGHT,
            java.awt.event.InputEvent.SHIFT_MASK));
    zoomInItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP,
            java.awt.event.InputEvent.SHIFT_MASK));
    zoomOutItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN,
            java.awt.event.InputEvent.SHIFT_MASK));
    toStartItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_HOME,
            java.awt.event.InputEvent.SHIFT_MASK));
    toEndItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_END,
            java.awt.event.InputEvent.SHIFT_MASK));
    preferencesItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, MiscUtils.MENU_MASK));
    crosshairItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_J, MiscUtils.MENU_MASK));
    plumblineItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_K, MiscUtils.MENU_MASK));
    spotlightItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, MiscUtils.MENU_MASK));
    bookmarksItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    genomeItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    rulerItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    statusBarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    pluginToolbarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T,
            MiscUtils.MENU_MASK | java.awt.event.InputEvent.SHIFT_MASK));
    exportItem.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, MiscUtils.MENU_MASK));

    if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
        tutorialsItem.setEnabled(false);
        userManualItem.setEnabled(false);
        websiteItem.setEnabled(false);
    }
    initBrowseMenu();
    try {
        RecentTracksController.getInstance().populateMenu(recentTrackMenu);
        RecentProjectsController.getInstance().populateMenu(recentProjectMenu);
    } catch (IOException ex) {
        LOG.error("Unable to populate Recent Items menu.", ex);
    }

}

From source file:com.willwinder.universalgcodesender.MainWindow.java

private void initProgram() {
    Localization.initialize(this.settings.getLanguage());
    try {//from  www  . j av a 2 s  .c o m
        backend.applySettings(settings);
    } catch (Exception e) {
        displayErrorDialog(e.getMessage());
    }

    this.setLocalLabels();
    this.loadPortSelector();
    this.checkScrollWindow();
    this.loadFirmwareSelector();
    this.setTitle(
            Localization.getString("title") + " (" + Localization.getString("version") + " " + VERSION + ")");

    // Command History
    this.manualCommandHistory = new ArrayList<>();

    // Add keyboard listener for manual controls.
    KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() {
        @Override
        public boolean dispatchKeyEvent(KeyEvent e) {
            // Check context.
            if (((arrowMovementEnabled.isSelected()) && e.getID() == KeyEvent.KEY_PRESSED)
                    && xPlusButton.isEnabled()) {
                switch (e.getKeyCode()) {
                case KeyEvent.VK_RIGHT:
                case KeyEvent.VK_KP_RIGHT:
                case KeyEvent.VK_NUMPAD6:
                    xPlusButtonActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_LEFT:
                case KeyEvent.VK_KP_LEFT:
                case KeyEvent.VK_NUMPAD4:
                    xMinusButtonActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_UP:
                case KeyEvent.VK_KP_UP:
                case KeyEvent.VK_NUMPAD8:
                    yPlusButtonActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_DOWN:
                case KeyEvent.VK_KP_DOWN:
                case KeyEvent.VK_NUMPAD2:
                    yMinusButtonActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_PAGE_UP:
                case KeyEvent.VK_NUMPAD9:
                    zPlusButtonActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_PAGE_DOWN:
                case KeyEvent.VK_NUMPAD3:
                    zMinusButtonActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_ADD:
                    increaseStepActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_SUBTRACT:
                    decreaseStepActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_DIVIDE:
                    divideStepActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_MULTIPLY:
                    multiplyStepActionPerformed(null);
                    e.consume();
                    return true;
                case KeyEvent.VK_INSERT:
                case KeyEvent.VK_NUMPAD0:
                    resetCoordinatesButtonActionPerformed(null);
                    e.consume();
                    return true;
                default:
                    break;
                }
            }

            return false;
        }
    });
}

From source file:FirstStatMain.java

private void stShortInfoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_stShortInfoKeyReleased
    if (evt.getKeyCode() == KeyEvent.VK_UP || evt.getKeyCode() == KeyEvent.VK_DOWN) {
        try {//  w  w  w . ja va  2s  .  c om
            int row = stShortInfo.getSelectedRow();
            String tableclick = (stShortInfo.getModel().getValueAt(row, 0).toString());
            String sql = "select * from Student_info where studentid='" + tableclick + "'";
            pst = connection.prepareStatement(sql);
            rst = pst.executeQuery();
            if (rst.next()) {
                getValue();

            }
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(rootPane, ex);
        }
    }
}

From source file:FirstStatMain.java

private void stTableInfoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_stTableInfoKeyReleased
    if (evt.getKeyCode() == KeyEvent.VK_UP || evt.getKeyCode() == KeyEvent.VK_DOWN) {
        try {/*from   w w w.  j  a  v a  2  s .  com*/
            int row = stTableInfo.getSelectedRow();
            String tableclick = (stTableInfo.getModel().getValueAt(row, 0).toString());
            String sql = "select * from Student_info where studentid='" + tableclick + "'";
            pst = connection.prepareStatement(sql);
            rst = pst.executeQuery();
            if (rst.next()) {
                getValue();

            }
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(rootPane, ex);
        }
    }
}

From source file:com.hexidec.ekit.EkitCore.java

public void keyPressed(KeyEvent ke) {

    // log.debug("> keyPressed");

    int keyCode = ke.getKeyCode();

    if (ke.getKeyChar() == KeyEvent.VK_ENTER && (enterIsBreak || inlineEdit)) {
        ke.consume();//w ww .  j  av a2 s.  c  om
    } else if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_KP_UP) {
        Element tdElement = DocumentUtil.getElementByTag(htmlDoc, jtpMain.getCaretPosition(), Tag.TD);
        if (tdElement != null) {
            moveCaretOnTable(tdElement, true, ke.isShiftDown());
            ke.consume();
        }
    } else if (keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_KP_DOWN) {
        Element tdElement = DocumentUtil.getElementByTag(htmlDoc, jtpMain.getCaretPosition(), Tag.TD);
        if (tdElement != null) {
            moveCaretOnTable(tdElement, false, ke.isShiftDown());
            ke.consume();
        }
    } else if (keyCode == KeyEvent.VK_ENTER) {
        Element tdElement = DocumentUtil.getElementByTag(htmlDoc, jtpMain.getCaretPosition(), Tag.TD);
        // inside table
        if (tdElement != null) {
            try {
                insertBreakInsideTD(tdElement);
            } catch (Exception e) {
                log.error("Falha ao inserir quebra de linha.", e);
            }
            ke.consume();
        }
    } else if (keyCode == KeyEvent.VK_D && ke.isShiftDown() && ke.isControlDown()) {
        debug();
    }

    // log.debug("< keyPressed");
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void treeStructMapKeyPressed(java.awt.event.KeyEvent evt) {
    if ((evt.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) {
        if (evt.getKeyCode() == KeyEvent.VK_DOWN) {
            moveItem(false);//from  w  ww  . j av a2  s  .c o m
        } else if (evt.getKeyCode() == KeyEvent.VK_UP) {
            moveItem(true);
        }
    }
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositMain.java

private void treeEntitiesKeyPressed(java.awt.event.KeyEvent evt) {
    if ((evt.getModifiersEx() & InputEvent.ALT_DOWN_MASK) != 0) {
        if (evt.getKeyCode() == KeyEvent.VK_DOWN) {
            moveItem(false);//from  w ww  .  j  ava  2s.c om
        } else if (evt.getKeyCode() == KeyEvent.VK_UP) {
            moveItem(true);
        }
    }
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.wbuploader.Uploader.java

public void keyPressed(KeyEvent e) {
    logDebug("keyPressed");
    int key = e.getKeyCode();
    if (key == KeyEvent.VK_ENTER || key == KeyEvent.VK_TAB || key == KeyEvent.VK_DOWN || key == KeyEvent.VK_UP
            || (key == KeyEvent.VK_TAB && e.isShiftDown()) || key == KeyEvent.VK_HOME
            || key == KeyEvent.VK_END) {
        editInvalidCell(e);/*w w  w . j a v  a 2 s. c o m*/
        e.consume();
    }
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.wbuploader.Uploader.java

/**
 * @param e/*from w  w  w.j  a v a  2  s.  c om*/
 * 
 * Moves to WB cell for appropriate InvalidValue and starts editing it.
 */
protected void editInvalidCell(KeyEvent e) {
    logDebug("editing invalid cell");
    int key = e.getKeyCode();
    if (key == KeyEvent.VK_ENTER || key == KeyEvent.VK_TAB || key == KeyEvent.VK_DOWN)
        goToNextInvalidCell();
    else if (key == KeyEvent.VK_UP || (key == KeyEvent.VK_TAB && e.isShiftDown()))
        goToPrevInvalidCell();
    else if (key == KeyEvent.VK_HOME)
        goToFirstInvalidCell();
    else if (key == KeyEvent.VK_END)
        goToLastInvalidCell();
}