任何人都可以幫助我嗎?按鍵時按下打印文字
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");
}
}
現在我想按某個鍵打印出來。
看看'System.in' – Lucas
http://docs.oracle.com/javase/6/docs/api/java/awt/event/KeyListener.html – Popgalop