user3626393
user3626393

Reputation: 31

how to accept keyboard shortcuts when jframe is not in focus?

I made an application using java which takes and stores screenshots in the specified folder. I set the shortcut ctrl+K to take and save the screenshot and I managed to make my application minimize to system tray when minimize button of jframe is pressed, but the problem is the keyboard shortcut assigned doesn't works as soon as jframe is either minimized or is put in background by some other application, Is it possible to make d application work even when JFrame is not in focus? Please help! Thanks! (I am making the application for windows only)

Upvotes: 1

Views: 766

Answers (1)

Tomas Bisciak
Tomas Bisciak

Reputation: 2841

For something like this i woud use 3th party lib like JNativeHook(I use it often) You can use Global listener nativehook

Here are some examples how to use it examples

Upvotes: 2

Related Questions