Ruang Java yang ditekan key

public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_SPACE){
      // Do something
    }
}
Baggi