Volodymyr Levytskyi
Volodymyr Levytskyi

Reputation: 3432

How to check in KeyListener that Ctrl was released?

I want to write keyReleased method which can check that Ctrl was released.

How to check that button is Ctrl in keyReleased handler?

Thanks friends!

Upvotes: 1

Views: 75

Answers (1)

Braj
Braj

Reputation: 46861

Add KeyListener on the component.

        public void keyReleased(KeyEvent event) {
            if(event.getKeyCode()==KeyEvent.VK_CONTROL){
                // ctrl key is released
            }
        }

Upvotes: 3

Related Questions