https://www.youtube.com/watch?v=bWHYjLJZswQ&t=9s
使用此代码块时:
package com.tutorial.main;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class KeyInput extends KeyAdapter{
public void keyPressed(KeyEvent e) { //when a key is pressed, the number value will be displayed.
int key = e.getKeyCode();
System.out.println(key);
}
public void keyReleased(KeyEvent e){
}
}
在本教程中,当程序运行时,按这些键时,我看不到调试窗口中的值。