How to check for key being held down on startup in Java

后端 未结 6 555
时光说笑
时光说笑 2020-12-11 04:11

I\'m trying to write a resolution selection dialog that pops up when a program first starts up. To prevent boring the user, I want to implement the fairly standard feature t

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 04:29

    Well there are two types of key press detection: event based, and polling. If you poll the keyboard for KEY_PRESSED on startup (through a loop with a sleep.thread(timeInMs) constantly checking if your key is down), then you can detect if it's already pressed on startup.

提交回复
热议问题