List of usage examples for java.awt.event KeyEvent VK_ENTER
int VK_ENTER
To view the source code for java.awt.event KeyEvent VK_ENTER.
Click Source Link
From source file:com.sshtools.sshterm.emulation.TerminalEmulation.java
public void keyTyped(int keyCode, char keyChar, int modifiers) { if (debug > 0) { System.out.println("keyTyped(" + keyCode + "," + keyChar + "," + modifiers); }//from ww w. j a v a2s . c o m // If there is a scrollbar, scroll to the end if ((display != null) && (display.getScrollBar() != null)) { if (display.getScrollBar().getValue() != display.getScrollBar().getMaximum()) { display.getScrollBar().setValue(display.getScrollBar().getMaximum()); } } boolean control = (modifiers & VDUInput.KEY_CONTROL) != 0; boolean shift = (modifiers & VDUInput.KEY_SHIFT) != 0; // fix problem with Linux Java 6 -- really nasty if (control && keyChar >= 'a' && keyChar <= 'z') keyChar = (char) (keyChar - 96); if (control && shift && keyChar >= 'A' && keyChar <= 'Z') keyChar = (char) (keyChar - 64); boolean alt = (modifiers & VDUInput.KEY_ALT) != 0; if (keyChar == '\t') { if (shift) { write(TabKey[1], false); } else { if (control) { write(TabKey[2], false); } else { if (alt) { write(TabKey[3], false); } else { write(TabKey[0], false); } } } return; } if (alt) { //04/04/07 commented out to stop shortcuts causing strange characters. //write("" + ( (char) (keyChar | 0x80))); return; } if (((keyCode == KeyEvent.VK_ENTER) || (keyChar == 10)) && !control) { if (((eol == EOL_DEFAULT) && sendcrlf) || (eol == EOL_CR_LF)) { write("\r\n", false); if (localecho) { putString("\r\n"); } } else { write("\r", false); if (localecho) { putString("\r"); } } return; } if ((keyCode == 10) && !control) { System.out.println("Sending \\r"); write("\r", false); return; } // FIXME: on german PC keyboards you have to use Alt-Ctrl-q to get an @, // so we can't just use it here... will probably break some other VMS // codes. -Marcus // if(((!vms && keyChar == '2') || keyChar == '@' || keyChar == ' ') // && control) if (((!vms && (keyChar == '2')) || (keyChar == ' ')) && control) { write("" + (char) 0); } if (vms) { if ((keyChar == 127) && !control) { if (shift) { writeSpecial(Insert[0]); } // VMS shift delete = insert else { writeSpecial(Remove[0]); } // VMS delete = remove return; } else if (control) { switch (keyChar) { case '0': writeSpecial(Numpad[0]); return; case '1': writeSpecial(Numpad[1]); return; case '2': writeSpecial(Numpad[2]); return; case '3': writeSpecial(Numpad[3]); return; case '4': writeSpecial(Numpad[4]); return; case '5': writeSpecial(Numpad[5]); return; case '6': writeSpecial(Numpad[6]); return; case '7': writeSpecial(Numpad[7]); return; case '8': writeSpecial(Numpad[8]); return; case '9': writeSpecial(Numpad[9]); return; case '.': writeSpecial(KPPeriod); return; case '-': case 31: writeSpecial(KPMinus); return; case '+': writeSpecial(KPComma); return; case 10: writeSpecial(KPEnter); return; case '/': writeSpecial(PF2); return; case '*': writeSpecial(PF3); return; /* * NUMLOCK handled in keyPressed */ default: break; } } /* * Now what does this do and how did it get here. -Marcus * if (shift && keyChar < 32) { * write(PF1+(char)(keyChar + 64)); * return; * } */ } if (debug > 2) { System.out.println("vt320: keyPressed " + keyCode + "\"" + keyChar + "\""); } // FIXME: not used? String[] fmap; int xind; xind = 0; fmap = FunctionKey; if (shift) { fmap = FunctionKeyShift; xind = 1; } if (control) { fmap = FunctionKeyCtrl; xind = 2; } if (alt) { fmap = FunctionKeyAlt; xind = 3; } if (keyCode == KeyEvent.VK_ESCAPE) { writeSpecial(Escape[xind]); return; } if ((modifiers & VDUInput.KEY_ACTION) != 0) { switch (keyCode) { case KeyEvent.VK_NUMPAD0: writeSpecial(Numpad[0]); return; case KeyEvent.VK_NUMPAD1: writeSpecial(Numpad[1]); return; case KeyEvent.VK_NUMPAD2: writeSpecial(Numpad[2]); return; case KeyEvent.VK_NUMPAD3: writeSpecial(Numpad[3]); return; case KeyEvent.VK_NUMPAD4: writeSpecial(Numpad[4]); return; case KeyEvent.VK_NUMPAD5: writeSpecial(Numpad[5]); return; case KeyEvent.VK_NUMPAD6: writeSpecial(Numpad[6]); return; case KeyEvent.VK_NUMPAD7: writeSpecial(Numpad[7]); return; case KeyEvent.VK_NUMPAD8: writeSpecial(Numpad[8]); return; case KeyEvent.VK_NUMPAD9: writeSpecial(Numpad[9]); return; case KeyEvent.VK_DECIMAL: writeSpecial(NUMDot[xind]); return; case KeyEvent.VK_ADD: writeSpecial(NUMPlus[xind]); return; } } if (!((keyChar == 8) || (keyChar == 127) || (keyChar == '\r') || (keyChar == '\n'))) { write("" + keyChar); return; } }
From source file:ru.goodfil.catalog.ui.forms.FiltersPanel.java
private void tbEngineKeyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { btnSearchMotorsActionPerformed(null); } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { tbEngine.setText(""); }// w ww . j a v a 2 s . com }
From source file:ru.goodfil.catalog.ui.forms.FiltersPanel.java
private void tbDateFKeyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { btnSearchMotorsActionPerformed(null); } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { tbDateF.setText(""); }/* w w w. j a va 2 s . c o m*/ }
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// ww w . ja va 2 s . 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:ru.goodfil.catalog.ui.forms.FiltersPanel.java
private void tbDateTKeyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { btnSearchMotorsActionPerformed(null); } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { tbDateT.setText(""); }// w ww .j a v a 2 s . c o m }
From source file:dictionary.GUI.GUI_Main.java
private void fieldWordKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_fieldWordKeyPressed if (evt.getKeyCode() == KeyEvent.VK_ENTER) { showMean();/*from ww w .j av a2 s . c om*/ } if (!onl && (evt.getKeyCode() == KeyEvent.VK_DOWN || evt.getKeyCode() == KeyEvent.VK_UP)) { listEntries.requestFocus(); } if (evt.getKeyCode() == KeyEvent.VK_F1) { if (comboBoxEV.getSelectedIndex() == 0) voice.speechText(fieldWord.getText()); } }
From source file:GUI.MainWindow.java
private void VulnTreeKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_VulnTreeKeyPressed int pressed = evt.getKeyCode(); if (pressed == KeyEvent.VK_DELETE) { doDelete();//w w w. ja v a2s. c om } else if (pressed == KeyEvent.VK_ENTER) { showNotes(); } }
From source file:dictionary.GUI.GUI_Main.java
private void listEntriesKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_listEntriesKeyPressed if (evt.getKeyCode() == KeyEvent.VK_ENTER) { fieldWord.setText(listEntries.getSelectedValue().toString()); frameEntries.dispose();// w w w.j a v a 2 s. com frameMean.setVisible(true); String tmp = fieldWord.getText(); fieldMean.setText(dic.search(new StringBuilder(tmp))); fieldMean.select(0, 0); frameMean.setLocation(this.getX() + this.getWidth(), this.getY()); buttonAdd.setEnabled(false); buttonSave.setEnabled(false); if (recentWord.isEmpty() || !recentWord.getFirst().equals(tmp)) { recentWord.addFirst(tmp); while (recentWord.size() > 10) { recentWord.removeLast(); } } } if (evt.getKeyCode() == KeyEvent.VK_BACK_SPACE) { fieldWord.requestFocus(); } }
From source file:br.com.atmatech.sac.view.ViewListaAtendimento.java
private void inicializaAtalhos() { KeyStroke keyStrokeJBnovo = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0); String actionNameJBnovo = "TECLA_F1"; InputMap inputMapJBnovo = jBnovo.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMapJBnovo.put(keyStrokeJBnovo, actionNameJBnovo); ActionMap actionMapJBMARCA = jBnovo.getActionMap(); actionMapJBMARCA.put(actionNameJBnovo, acaojBnovo); //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 atualizar KeyStroke keyStrokeJBatualizar = KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0); String actionNameJBatualizar = "F5"; InputMap inputMapJBatualizar = jBpesquisa.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMapJBatualizar.put(keyStrokeJBatualizar, actionNameJBatualizar); ActionMap actionMapJBatualizar = jBpesquisa.getActionMap(); actionMapJBatualizar.put(actionNameJBatualizar, acaoJBpesquisa); //Atalho enter InputMap inputMapJBenter = this.jDconsulta.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMapJBenter.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "forward"); this.jDconsulta.getRootPane().setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, inputMapJBenter); this.jDconsulta.getRootPane().getActionMap().put("forward", new AbstractAction() { private static final long serialVersionUID = 1L; @Override/*from w w w .ja va 2 s. c om*/ public void actionPerformed(ActionEvent e) { filtraChamado(); } }); }
From source file:Report_PRCR_New_EPF_Excel_File_Generator.java
private void monthfield1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_monthfield1KeyPressed if (monthfield1.getText().equals("Jan")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Dec"); int yr = Integer.parseInt(yearfield.getText()); yearfield1.setText("" + (yr - 1)); monthfield1.selectAll();/*from ww w .ja v a 2 s . co m*/ } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Feb"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Feb")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Jan"); int yr = Integer.parseInt(yearfield.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Mar"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Mar")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Feb"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Apr"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Apr")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Mar"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("May"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("May")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Apr"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Jun"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Jun")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("May"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Jul"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Jul")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Jun"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Aug"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Aug")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Jul"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Sep"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Sep")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Aug"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Oct"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Oct")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Sep"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Nov"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Nov")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Oct"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Dec"); monthfield1.selectAll(); } } else if (monthfield1.getText().equals("Dec")) { if (evt.getKeyCode() == KeyEvent.VK_DOWN) { monthfield1.setText("Nov"); int yr = Integer.parseInt(yearfield1.getText()); monthfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_UP) { monthfield1.setText("Jan"); int yr = Integer.parseInt(yearfield1.getText()); yearfield1.setText("" + (yr + 1)); monthfield1.selectAll(); } } if (evt.getKeyCode() == KeyEvent.VK_LEFT) { dayfield.requestFocus(); dayfield.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_RIGHT) { yearfield1.requestFocus(); yearfield1.selectAll(); } if (evt.getKeyCode() == KeyEvent.VK_ENTER) { ////// ChaNGE focus on enter//////////////// // recieptNo.requestFocus(); } }