您如何应用按键监听器进行双击?也就是说,你打一次它就会打开,然后你再打一次它就会关闭。我可以通过 LWJGL 键盘做到这一点,但不能通过 AWT 的 KeyEvent 做到这一点。你怎么能用 AWT 做到这一点?
我的尝试:
public static void fullscreenKey(KeyEvent e2, JFrame frame)
{
int key = e2.getKeyCode();
if(key == KeyEvent.VK_F1)
{
fullscreen(false, frame);
f1 = false;
}
if(key == KeyEvent.VK_F1 && !f1)
{
fullscreen(true, frame);
f1 = true;
}
}
我还需要在其他类中调用这个方法。