Example usage for java.awt.event KeyEvent getKeyChar

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

Introduction

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

Prototype

public char getKeyChar() 

Source Link

Document

Returns the character associated with the key in this event.

Usage

From source file:com.cmsoftware.keyron.vista.admin.AgregarEmpleado.java

private void emailKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_emailKeyTyped
    labelError.setText("");
    email.setBackground(new Color(255, 255, 255));
    if (evt.getKeyChar() == '\n') {
        guardarActionPerformed(null);//from w  w w. j  av  a 2s . c om
    }
}

From source file:com.cmsoftware.keyron.vista.admin.AgregarEmpleado.java

private void nombreKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_nombreKeyTyped
    labelError.setText("");
    nombre.setBackground(new Color(255, 255, 255));
    if (evt.getKeyChar() == '\n') {
        guardarActionPerformed(null);/*w  w w.j a v a2 s  . co m*/
    }
}

From source file:com.cmsoftware.keyron.vista.admin.AgregarEmpleado.java

private void cedulaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cedulaKeyTyped
    labelError.setText("");
    cedula.setBackground(new Color(255, 255, 255));
    if (evt.getKeyChar() < '0' || evt.getKeyChar() > '9') {
        evt.consume();/*w w w.ja  v a2s.c  om*/
        Toolkit.getDefaultToolkit().beep();
    }
}

From source file:com.cmsoftware.keyron.vista.admin.AgregarEmpleado.java

private void apellidoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_apellidoKeyTyped
    labelError.setText("");
    apellido.setBackground(new Color(255, 255, 255));
    if (evt.getKeyChar() == '\n') {
        guardarActionPerformed(null);/*from ww  w  .j a v a2  s. c  o  m*/
    }
}

From source file:com.cmsoftware.keyron.vista.admin.AgregarEmpleado.java

private void direccionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_direccionKeyTyped
    labelError.setText("");
    direccion.setBackground(new Color(255, 255, 255));
    if (evt.getKeyChar() == '\n') {
        guardarActionPerformed(null);/*from w  ww .j av  a 2  s  . c o m*/
    }
}

From source file:com.cmsoftware.keyron.vista.admin.AgregarEmpleado.java

private void telefonoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_telefonoKeyTyped
    labelError.setText("");
    telefono.setBackground(new Color(255, 255, 255));
    if (evt.getKeyChar() == '\n') {
        guardarActionPerformed(null);//from  ww  w . j  a  v  a2s  .co m
    }
    if (evt.getKeyChar() < '0' || evt.getKeyChar() > '9') {
        evt.consume();
        Toolkit.getDefaultToolkit().beep();
    }
}

From source file:ropes.MainWindow.java

private void jTextField_sliderValueKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField_sliderValueKeyTyped
    char c = evt.getKeyChar();
    String txtVal = jTextField_sliderValue.getText();
    if (txtVal.equals("") && (c == KeyEvent.VK_BACK_SPACE || c == KeyEvent.VK_DELETE)) {
        evt.consume();//w  ww.  j a v  a 2s  .c om
        return;
    }
    if (!"".equals(txtVal)) {
        if (!(Character.isDigit(c) || c == KeyEvent.VK_BACK_SPACE || c == KeyEvent.VK_DELETE)
                || jSlider_size_select.getMaximum() <= Integer.valueOf(txtVal)) {
            evt.consume();
        } else {

            if (Integer.valueOf(txtVal) == 0)
                jTextField_sliderValue.setText("");
        }
    }

    //Integer textFieldVal = Integer.valueOf(jTextField_sliderValue.getText());
    // jSlider_size_select.setValue(WIDTH);
}

From source file:com.cmsoftware.keyron.vista.admin.EditarEmpleado.java

private void telefonoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_telefonoKeyTyped
    labelError.setText("");
    telefono.setBackground(new Color(255, 255, 255));
    if (evt.getKeyChar() == '\n') {
        guardarActionPerformed(null);//from   w w  w .  j  a v  a 2s  . co  m
    }
    if (evt.getKeyChar() < '0' || evt.getKeyChar() > '9') {
        evt.consume();
        Toolkit.getDefaultToolkit().beep();
    }

}

From source file:userinterface.Citizen.CitizenWorkAreaJPanel.java

private void resRateFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_resRateFieldKeyPressed
    if (Character.isLetter(evt.getKeyChar())) {
        evt.consume();/* www.  ja v  a  2  s .  c o m*/
    } else {
        return;
    }
}

From source file:dylemator.DylematorUI.java

private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
    char key = evt.getKeyChar();
    int keyCode = evt.getKeyCode();
    if (keyCode == 27) {
        this.displayCenteredText("");
        this.threadRunning = false;
        setFullscreen(false);/*from w ww .ja  v  a  2s  .  c o  m*/
        mainMenuBar.setVisible(true);
        answerPanel.setVisible(true);

    }
    switch (key) {
    case ' ':
        if (this.questionThread != null) {
            synchronized (this.questionThread) {
                if (this.questionThread.readMode == true)
                    this.questionThread.notifyAll();
                if (this.questionThread.nextTextMode == true)
                    this.questionThread.notifyAll();
            }
        }
        break;
    case 'V':
    case 'v':
        if (this.questionThread.questionMode == true)
            this.questionThread.answer("TAK");
        break;
    case 'N':
    case 'n':
        if (this.questionThread.questionMode == true)
            this.questionThread.answer("NIE");
        break;
    case 'S':
    case 's':
        startButtonActionPerformed(null);
        break;
    //            case 'F': 
    //            case 'f': this.setFullscreen(true);
    //                      this.answerPanel.setVisible(false);
    //                      firstScreen(0);
    }
}