@Override public void keyPressed(KeyEvent event){
  try {
    if (event.getKeyChar() == '\n') {
      onReturnPressed(event);
    }
 else     if (event.getKeyChar() == '\t') {
      onTabPressed(event);
    }
  }
 catch (  BadLocationException e) {
    e.printStackTrace();
  }
}

@ Override public void keyPressed ( KeyEvent event ) { try { if ( event . getKeyChar ( ) == '\n' ) { onReturnPressed ( event ) ; } else if ( event . getKeyChar ( ) == '\t' ) { onTabPressed ( event ) ; } } catch ( BadLocationException e ) { e . printStackTrace ( ) ; } }
reacts to pressed keys ( returns and tabs ) .
