Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java desktop app: How to maximize tray application when hotkey pressed?

I need to write a program that, when minimized, lives in the System Tray, and I'll use Java 6's SystemTray API to do that.

How can I make that application comes to the foreground when the user presses some hotkey?

For example, the app is running but minimized. When the user presses CTRL-SHIFT-Y or something (or, like Google Desktop's search, CTRL twice) and the application is maximized.

EDIT: I know about how to bring a Java window to the foreground. I'm asking more specifically about how to make a running Java app listen for a hotkey.

like image 582
David Koelle Avatar asked May 04 '09 15:05

David Koelle


1 Answers

You're going to need to resort to JNI, check out an example.

Here's another nice example from Sun's forums.

like image 66
Yuval Adam Avatar answered Sep 22 '22 12:09

Yuval Adam