List of usage examples for java.awt.event KeyEvent consume
public void consume()
From source file:schoolsystem.FeeModule.java
private void txt_fee_module_amt_paidKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_fee_module_amt_paidKeyTyped // TODO add your handling code here: if (evt.getKeyChar() >= '0' && evt.getKeyChar() <= '9') { } else {//from w w w . j av a2 s.c o m evt.consume(); Toolkit.getDefaultToolkit().beep(); } }
From source file:com.mirth.connect.client.ui.components.KeyStrokeTextField.java
@Override public void keyReleased(KeyEvent evt) { if (keyCode != null && (evt.getKeyCode() == KeyEvent.VK_ENTER || evt.getKeyCode() == KeyEvent.VK_ESCAPE)) { return;/*from www . j av a2 s. c o m*/ } if (keyCode == null && evt.getKeyCode() > 0 && modifiers > 0 && !ArrayUtils.contains(ignoreKeyCodes, evt.getKeyCode())) { int index = ArrayUtils.indexOf(modifierKeyCodes, evt.getKeyCode()); if (index >= 0 && keyCode == null) { modifiers = (modifiers ^= modifierMasks[index]) & modifiers; } else { keyCode = evt.getKeyCode(); } updateKeyStroke(); PlatformUI.MIRTH_FRAME.setSaveEnabled(true); } evt.consume(); }
From source file:vistas.GestionPersonal.java
private void txt_NameKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_NameKeyTyped char car = evt.getKeyChar(); if ((car < 'a' || car > 'z') && (car < 'A' || car > 'Z') && (car != (char) KeyEvent.VK_SPACE) && (car != (char) KeyEvent.VK_BACK_SPACE)) { JOptionPane.showMessageDialog(this, "Ingrese solo letras"); evt.consume(); }//from w w w . jav a2 s. c om }
From source file:vistas.GestionPersonal.java
private void txt_apellidoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_apellidoKeyTyped char car = evt.getKeyChar(); if ((car < 'a' || car > 'z') && (car < 'A' || car > 'Z') && (car != (char) KeyEvent.VK_SPACE) && (car != (char) KeyEvent.VK_BACK_SPACE)) { JOptionPane.showMessageDialog(this, "Ingrese solo letras"); evt.consume(); }//from ww w.j a va2 s.c o m }
From source file:schoolsystem.FeeModule.java
private void txt_fee_moduleKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_fee_moduleKeyTyped if (evt.getKeyChar() >= '0' && evt.getKeyChar() <= '9') { } else {/*from w ww. j a v a 2 s. c o m*/ if (evt.getKeyChar() == KeyEvent.VK_SLASH) { } else { evt.consume(); Toolkit.getDefaultToolkit().beep(); } } // TODO add your handling code here: }
From source file:schoolsystem.FeeModuleDialog.java
private void txt_fee_module_amt_paidKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_fee_module_amt_paidKeyTyped if (evt.getKeyChar() >= '0' && evt.getKeyChar() <= '9') { } else {/* w ww. ja v a 2 s.c om*/ evt.consume(); Toolkit.getDefaultToolkit().beep(); } //code here: }
From source file:practica1.Babage.java
private void cantidadClaveKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cantidadClaveKeyTyped char c = evt.getKeyChar(); if (Character.isLetter(c)) { getToolkit().beep();// w w w . j a v a 2s . co m evt.consume(); } }
From source file:practica1.Babage.java
private void textoEncriptadoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textoEncriptadoKeyTyped char c = evt.getKeyChar(); if (Character.isDigit(c)) { getToolkit().beep();//from www . j av a2 s . c o m evt.consume(); } }
From source file:org.openconcerto.erp.core.common.ui.DeviseField.java
public static void addFilteringKeyListener(final JTextField textField) { textField.addKeyListener(new KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent keyEvent) { final char keychar = keyEvent.getKeyChar(); if (keychar == KeyEvent.VK_BACK_SPACE) { return; }/* w w w.j a va2s .co m*/ // pas plus de 2 chiffres apres la virgule int pointPosition = textField.getText().indexOf('.'); if (Character.isDigit(keychar)) { if (pointPosition > -1) { // System.err.println("Text Selected :: " + textField.getSelectedText()); if (textField.getSelectedText() == null) { if (textField.getCaretPosition() <= pointPosition) { return; } else { if (textField.getText().substring(pointPosition).length() <= 2) { return; } } } else { return; } } else { return; } } if (keychar == KeyEvent.VK_PERIOD && textField.getText().indexOf('.') < 0) return; // if (keychar == KeyEvent.VK_MINUS && (textField.getText().indexOf('-') < 0) && // textField.getCaretPosition() == 0) // return; keyEvent.consume(); } }); }
From source file:com.smanempat.controller.ControllerClassification.java
public void validasiNumberofNearest(java.awt.event.KeyEvent evt, JTextField textNumberOfK, JLabel labelPesanError) { ModelClassification modelClassification = new ModelClassification(); String numberValidate = textNumberOfK.getText(); int modelRow = modelClassification.getRowCount(); if (Pattern.matches("[0-9]+", numberValidate) == false && numberValidate.length() > 0) { evt.consume(); labelPesanError.setText("Number of Nearest Neighbor tidak valid"); } else if (numberValidate.length() == 9) { evt.consume();/*from w w w. j a v a2s . co m*/ labelPesanError.setText("Number of Nearest Neighbor terlalu panjang"); } else { labelPesanError.setText(""); } }