public void keyTyped(KeyEvent evt){
  int modifiers=evt.getModifiers();
  char c=evt.getKeyChar();
  if (c != KeyEvent.CHAR_UNDEFINED && (modifiers & KeyEvent.ALT_MASK) == 0) {
    if (c >= 0x20 && c != 0x7f) {
      KeyStroke keyStroke=KeyStroke.getKeyStroke(Character.toUpperCase(c));
      Object o=currentBindings.get(keyStroke);
      if (o instanceof Hashtable) {
        currentBindings=(Hashtable)o;
        return;
      }
 else       if (o instanceof ActionListener) {
        currentBindings=bindings;
        executeAction((ActionListener)o,evt.getSource(),String.valueOf(c),modifiers);
        return;
      }
      currentBindings=bindings;
      if (grabAction != null) {
        handleGrabAction(evt);
        return;
      }
      if (repeat && Character.isDigit(c)) {
        repeatCount*=10;
        repeatCount+=(c - '0');
        return;
      }
      executeAction(INSERT_CHAR,evt.getSource(),String.valueOf(evt.getKeyChar()),modifiers);
      repeatCount=0;
      repeat=false;
    }
  }
}

public void keyTyped ( KeyEvent evt ) { int modifiers = evt . getModifiers ( ) ; char c = evt . getKeyChar ( ) ; if ( c != KeyEvent . CHAR_UNDEFINED && ( modifiers & KeyEvent . ALT_MASK ) == 0 ) { if ( c >= 0x20 && c != 0x7f ) { KeyStroke keyStroke = KeyStroke . getKeyStroke ( Character . toUpperCase ( c ) ) ; Object o = currentBindings . get ( keyStroke ) ; if ( o instanceof Hashtable ) { currentBindings = ( Hashtable ) o ; return ; } else if ( o instanceof ActionListener ) { currentBindings = bindings ; executeAction ( ( ActionListener ) o , evt . getSource ( ) , String . valueOf ( c ) , modifiers ) ; return ; } currentBindings = bindings ; if ( grabAction != null ) { handleGrabAction ( evt ) ; return ; } if ( repeat && Character . isDigit ( c ) ) { repeatCount *= 10 ; repeatCount += ( c - '0' ) ; return ; } executeAction ( INSERT_CHAR , evt . getSource ( ) , String . valueOf ( evt . getKeyChar ( ) ) , modifiers ) ; repeatCount = 0 ; repeat = false ; } } }
handle a key typed event . this inserts the key into the text area .
