public void keyReleased(KeyEvent ke) { if (ke.getKeyCode() == KeyEvent.VK_UP) { String up = history.getUp(); if (up != null) messageText.setText(up); } else if (ke.getKeyCode() == KeyEvent.VK_DOWN) { String down = history.getDown(); if (down != null) messageText.setText(down); } }
public void keyTyped(KeyEvent ke) { if (ke.getKeyChar() == KeyEvent.VK_ENTER) { sendMessage(); } }