Timer on event listener (Java)
Hello.
My question is: in example there is a KeyListener which waits for a particular button to be pressed. I need to make so that after the button is pressed once, the next several seconds it would be inactive. In other words, if I press it now, the keyPressed method would be executed, but after that the next 2 seconds I could spam the same button and nothing would be executed until the time is finished. After 2 seconds it becomes active again and once pressed would perform keyPressed method.
I hope you got the idea from my poor english.
|