An SO User
An SO User

Reputation: 25018

Can a JFrame reappear when a certain key combination is pressed?

The defaultCloseOperation() in my JFrame is set to DO_NOTHING_ON_CLOSE. The IDE shows that the program is still running and there is no way to get the JFrame back.

I want to know, how do I get the JFrame to be visible again if a certain key combination is pressed like SHIFT+V ? Like in some parental control and surveillance softwares

I know KeyListener can not be used cause it needs something focussable to which input can be sent... so what is the way around ??
Can it reappear when some keys are pressed ?

Upvotes: 1

Views: 128

Answers (2)

mKorbel
mKorbel

Reputation: 109823

EDIT

Upvotes: 1

Naranca
Naranca

Reputation: 73

First of you make a windows adapter so that you can use the windowClosing method inside it. This method overrides the default EXIT_ON_CLOSE or in you case DO_NOTHING_ON_CLOSE and write what you want to happen when the program tries to exit on the red X. Hope it helps

Upvotes: 1

Related Questions