Может ли кто-нибудь помочь мне в этом?Распечатать текст при нажатии клавиши
public class DemoTest {
public static void main(String[] args) {
keyPressed();
}
public static void keyPressed() {
//If player presses the key 1 then print the line:
System.out.println("You pressed the key 1");
}
}
Теперь я хочу, чтобы что-то было распечатано при нажатии клавиши 1.
Посмотрите на 'System.in' – Lucas
http://docs.oracle.com/javase/6/docs/api/java/awt/event/KeyListener.html – Popgalop