add method keyPressed()