This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes SystemTray and task bar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SystemTray and task bar" Watch "SystemTray and task bar" New topic
Author

SystemTray and task bar

Carey Brown
Ranch Hand

Joined: Nov 19, 2001
Posts: 173

I would like to create a program that is controlled entirely via the SystemTray and does NOT require any presence on the Windows task bar. The SystemTray part of the problem is not an issue. I've written some SystemTray code in the past. What I don't know how to do is prevent a running java program from appearing on the task bar. Any suggestions would be appreciated. Is this even possible?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10171
    
    8

If you use a JWindow instead of a JFrame for your UI, it does not show up on the taskbar.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

Or a non-modal JDialog.

Moving to our user interface forum.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Carey Brown
Ranch Hand

Joined: Nov 19, 2001
Posts: 173

Thanks for your feedback! I'll read up on both of those solutions.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
note that a JWindow without a visible parent will not allow focus for typing in textfields etc
if you do require focus, there is a workaround/hack that eliminates the visible parent i.e. does not appear in taskbar
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10171
    
    8

This is interesting. I was not aware of this one.
I just ran a small test and looks like JTextComponents and their children indeed do not receive focus. However, components like JCheckBox JButton, JTree do.

Michael, could you please share the hack?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
just need to tell the JWindow it has a visible parent, even though it doesn't

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10171
    
    8

Ah! I forgot all about isShowing and kept fiddling with setVisible. Duh!
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SystemTray and task bar
 
Similar Threads
Hidding into taskbar
Key Class object does not map to any field
SystemTray not supported
How to create status/progress bar in java using threads?
I want to add/modify to this icon that runs the jar