List of usage examples for java.awt.event KeyEvent VK_UP
int VK_UP
To view the source code for java.awt.event KeyEvent VK_UP.
Click Source Link
From source file:cn.pholance.datamanager.common.components.JRViewer.java
protected void keyNavigate(KeyEvent evt) { boolean refresh = true; switch (evt.getKeyCode()) { case KeyEvent.VK_DOWN: case KeyEvent.VK_PAGE_DOWN: dnNavigate(evt);//from ww w . j a v a 2 s .c o m break; case KeyEvent.VK_UP: case KeyEvent.VK_PAGE_UP: upNavigate(evt); break; case KeyEvent.VK_HOME: homeEndNavigate(0); break; case KeyEvent.VK_END: homeEndNavigate(jasperPrint.getPages().size() - 1); break; default: refresh = false; } if (refresh) { refreshPage(); } }
From source file:Demo3D.java
/** * Override Behavior's stimulus method to handle the event. This method is * called when a key on the keyboard has been pressed and operates on the * specified transform group to move the camera. * /*from w ww .j a va2s. com*/ * @param Enumeration * criteria - all pressed keys in a list. This will be passed by * the system. */ public void processStimulus(Enumeration criteria) { WakeupOnAWTEvent eventToWakeUp; AWTEvent[] events; if (criteria.hasMoreElements()) { // Decode the wakeup criteria eventToWakeUp = (WakeupOnAWTEvent) criteria.nextElement(); events = eventToWakeUp.getAWTEvent(); keyEvent = (KeyEvent) events[0]; int keyCode = keyEvent.getKeyCode(); // Perform our processing // Get the initial transformation from target and put it into // myKeyNavTransf3D target_trGr.getTransform(myKeyNavTransf3D); // Set the translational components of myKeyNavTransf3D in // translation myKeyNavTransf3D.get(translation); // Not any of the 8 motions (6 translations and 2 rotations) // don't act simultaneously. switch (keyCode) { case KeyEvent.VK_UP: // Up Arrow - to move forward trans_rot.set(new Vector3f(0.0f, 0.0f, -step)); break; case KeyEvent.VK_DOWN: // Down Arrow - to move backwards trans_rot.set(new Vector3f(0.0f, 0.0f, step)); break; case KeyEvent.VK_LEFT: // Left Arrow -to turn left or move left if (keyEvent.isShiftDown()) trans_rot.set(new Vector3f(-step, 0.0f, 0.0f)); else trans_rot.rotY(angle); break; case KeyEvent.VK_RIGHT: // Right Arrow - to turn right or move right if (keyEvent.isShiftDown()) trans_rot.set(new Vector3f(step, 0.0f, 0.0f)); else trans_rot.rotY(-angle); break; case KeyEvent.VK_PAGE_DOWN: // Page Down - to move down trans_rot.set(new Vector3f(0.0f, -step, 0.0f)); break; case KeyEvent.VK_PAGE_UP: // Page Up - to move up trans_rot.set(new Vector3f(0.0f, step, 0.0f)); break; default: trans_rot.set(new Vector3f(0.0f, 0.0f, 0.0f)); } myKeyNavTransf3D.mul(trans_rot); // Return the final transformation myKeyNavTransf3D to target target_trGr.setTransform(myKeyNavTransf3D); } // Set wakeup criteria for next time. wakeupOn(wakeUp); }
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);// ww w .j ava2 s . com } 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(//w ww .ja v a 2 s . c o m 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 w w w .j a v a 2 s.com*/ 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 {// ww w. j av a2 s . c o m 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 {/*w w w .j a v a2 s . c o m*/ 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();/*from w ww . j a v a 2 s.c o m*/ } 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 ww w . j ava2 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 w w . j a v a2 s. c om } else if (evt.getKeyCode() == KeyEvent.VK_UP) { moveItem(true); } } }