do something once the key is held and repeat when its released and repressed

前端 未结 2 447
执念已碎
执念已碎 2021-01-14 04:56

I need to check when the user presses on a key and releases it. If a key is held in, I will do something once.

I used the keystroke to get the button I want to relat

2条回答
  •  悲&欢浪女
    2021-01-14 04:58

    I don't believe you can achieve what you need in Linux, because the operating system continually issues press/release signals to the JVM.

    See

    • How to stop repeated keyPressed() / keyReleased() events in Swing
    • How to know when a user has really released a key in Java?

提交回复
热议问题