Skip to content
Advertisement

Tag: keyboard

Change the mouse cursor when shift key is pressed

I have a subclass PointPanel of JPanel, where I want to implement the following behavior: If the mouse hovers the instance and the shift key is pressed, the mouse cursor changes to the hand cursor; if the shift key is released, the mouse cursor changes back to the default cursor. In order to achieve this, I tried to add a

Ending a timer using keyadapters?

So, I am creating this reaction time game that shows a blue ball and once you see that blue ball, you press up arrow key to get your reaction time once it turned blue. However, I am having trouble in creating a timer. I want the timer to start once the ball actually turns blue and want that timer to

How to check for a sequence of keystrokes

I’m making a game and want to implement cheat codes like the Konami code. But how do I check for that sequence of keystrokes? I want it to work so that if a player just types the code it will trigger. Thanks in advance! Answer Below is a class that checks for the Konami code, including cases such as “UP,

Advertisement