List of usage examples for java.awt.event KeyEvent getKeyCode
public int getKeyCode()
From source file:GUI.MainWindow.java
private void VulnAffectedHostsTableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_VulnAffectedHostsTableKeyPressed if (evt.getKeyCode() == KeyEvent.VK_ENTER) { showNotesForSpecificHost();//from ww w.j a v a2s .c o m } else if (evt.getKeyChar() == KeyEvent.VK_DELETE) { deleteAffectedHosts(); } else if (evt.getKeyCode() == KeyEvent.VK_INSERT) { addAffectedHost(); } }
From source file:edu.ku.brc.ui.UIHelper.java
public static JTextArea createTextArea() { final JTextArea text = new JTextArea(); setControlSize(text);// www . j a va 2s .c o m // Enable being able to TAB out of TextArea text.getInputMap().put(KeyStroke.getKeyStroke("TAB"), "none"); text.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent event) { if (event.getKeyCode() == VK_TAB) { if (event.isShiftDown()) { text.transferFocusBackward(); } else { text.transferFocus(); } } } }); return text; }
From source file:GUI.MainWindow.java
private void VulnReferencesListKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_VulnReferencesListKeyPressed int pressed = evt.getKeyCode(); if (pressed == KeyEvent.VK_DELETE) { deleteReferences(VulnTree, VulnReferencesList); } else if (pressed == KeyEvent.VK_INSERT) { addReference(VulnTree, VulnReferencesList, null); }//from w ww . j av a2s.co m }
From source file:edu.ucla.stat.SOCR.chart.Chart.java
public void keyPressed(KeyEvent e) { //System.out.println("Chart: keyPressed="+e.getKeyCode()+"dataTable.getSelectedRow()="+dataTable.getSelectedRow()); if (e.getKeyCode() == 127 || e.getKeyCode() == 8) { if ((dataTable.getSelectedRow() >= 0) && (dataTable.getSelectedColumn() >= 0)) { int[] rows = dataTable.getSelectedRows(); int[] cols = dataTable.getSelectedColumns(); for (int i = rows[0]; i <= rows[rows.length - 1]; i++) for (int j = cols[0]; j <= cols[cols.length - 1]; j++) { dataTable.setValueAt(null, i, j); }//from ww w . j a v a 2s . c o m } dataPanel.removeAll(); JScrollPane tablePanel = new JScrollPane(dataTable); tablePanel.setRowHeaderView(headerTable); dataPanel.add(tablePanel); dataPanel.add(new JScrollPane(summaryPanel)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataPanel.validate(); } }
From source file:edu.ku.brc.ui.UIHelper.java
/** * Adds a special key listener to process a RETURN key for selecting and item * in the popup list. This is installed only for Windows and Linux. * @param popupMenu the popup menu to be altered. *//*from ww w . ja va 2 s. co m*/ public static void addSpecialKeyListenerForPopup(final JPopupMenu popupMenu) { if (!UIHelper.isMacOS()) { popupMenu.addKeyListener(new KeyAdapter() { //@Override public void keyPressed(KeyEvent e) { super.keyPressed(e); if (e.getKeyCode() == VK_ENTER) { for (int i = 0; i < popupMenu.getComponentCount(); i++) { Component c = popupMenu.getComponent(i); if (c instanceof JMenuItem) { JMenuItem mi = (JMenuItem) c; if (mi.isArmed()) { mi.doClick(); popupMenu.setVisible(false); } } } } } }); } }
From source file:ca.uhn.hl7v2.testpanel.ui.v2tree.Hl7V2MessageTree.java
private void handleKeyPress(KeyEvent theE) { int row = getSelectedRow(); if (row == -1) { return;/* www. j ava 2s. c o m*/ } if (theE.getKeyCode() == KeyEvent.VK_ENTER || theE.getKeyCode() == KeyEvent.VK_F2) { AbstractLayoutCache layout = ((OutlineModel) getModel()).getLayout(); TreePath path = layout.getPathForRow(row); TreeNodeBase baseObj = (TreeNodeBase) path.getLastPathComponent(); if (myTableModel.isCellEditable(baseObj, TreeRowModel.COL_VALUE)) { editCellAt(row, TreeRowModel.COL_VALUE + 1); theE.consume(); } } }
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 {//from w ww .j a va 2 s .com 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 www .ja v a2s .co 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:pl.edu.icm.visnow.geometries.viewer3d.Display3DPanel.java
private void formKeyPressed(KeyEvent evt) { if (lockView) { return;//from w w w.jav a 2s . c om } double dAngle = Math.PI / 144; double dScale = 129. / 128.; if (storingFrames) { dAngle = Math.PI / 360; dScale = 513. / 512.; } if ((evt.getModifiers() & KeyEvent.CTRL_MASK) != 0) { dAngle = Math.PI / 2; } if ((evt.getModifiers() & KeyEvent.SHIFT_MASK) != 0) { dAngle = Math.PI / 6; } objRotate.getTransform(tempTransform); Transform3D rot = new Transform3D(); switch (evt.getKeyCode()) { case KeyEvent.VK_NUMPAD5: reset(); break; case KeyEvent.VK_DOWN: case KeyEvent.VK_KP_DOWN: case KeyEvent.VK_NUMPAD2: rot.rotX(dAngle); break; case KeyEvent.VK_UP: case KeyEvent.VK_KP_UP: case KeyEvent.VK_NUMPAD8: rot.rotX(-dAngle); break; case KeyEvent.VK_LEFT: case KeyEvent.VK_KP_LEFT: case KeyEvent.VK_NUMPAD4: rot.rotY(-dAngle); break; case KeyEvent.VK_RIGHT: case KeyEvent.VK_KP_RIGHT: case KeyEvent.VK_NUMPAD6: rot.rotY(dAngle); break; case KeyEvent.VK_PAGE_UP: case KeyEvent.VK_NUMPAD9: rot.rotZ(dAngle); break; case KeyEvent.VK_PAGE_DOWN: case KeyEvent.VK_NUMPAD3: rot.rotZ(-dAngle); break; } rot.mul(tempTransform); objRotate.setTransform(rot); switch (evt.getKeyCode()) { case KeyEvent.VK_HOME: case KeyEvent.VK_NUMPAD7: mouseScale *= dScale; break; case KeyEvent.VK_END: case KeyEvent.VK_NUMPAD1: mouseScale /= dScale; break; } tempTransform = new Transform3D(new Matrix3d(1., 0., 0., 0., 1., 0., 0., 0., 1.), //sceneCenter, new Vector3d(0.0, 0.0, 0.0), externScale * mouseScale); objScale.setTransform(tempTransform); switch (evt.getKeyCode()) { case CAMERA_UP_KEY: cameraUpKeyPressed = true; processCameraKeys(evt); break; case CAMERA_DOWN_KEY: cameraDownKeyPressed = true; processCameraKeys(evt); break; case CAMERA_LEFT_KEY: cameraLeftKeyPressed = true; processCameraKeys(evt); break; case CAMERA_RIGHT_KEY: cameraRightKeyPressed = true; processCameraKeys(evt); break; case CAMERA_FORWARD_KEY: cameraForwardKeyPressed = true; processCameraKeys(evt); break; case CAMERA_BACKWARD_KEY: cameraBackwardKeyPressed = true; processCameraKeys(evt); break; // TODO milimetr: delete the code below after testing case '8': pickObject.setPickModuleMode(1); break; case '9': pickObject.setPickModuleMode(2); break; case '0': pickObject.setPickModuleMode(3); break; default: break; } }
From source file:ru.goodfil.catalog.ui.forms.FiltersPanel.java
private void tblMotorsKeyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { btnDetachMotorActionPerformed(null); }//from w w w . j a v a 2s .c om }