Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Close Group function via taskbar right-click menu

 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In WindowsXP, if you have multiple windows of a program (ex: many notepads, browser windows, etc), program titles on the taskbar gets grouped under the common name. (assumed that user have checked "Group similar taskbar buttons" in "Taskbar and Start menu Properties")

This allows user to right-click on grouped program taskbox on the taskbar and click "Close Group" that closes all the windows/instances of the group. How to handle this in a java application that has similar behavior(multiple windows) ?

There are several other related issues such as icon / task bar name changes upon taskbar grouping in Windows, which seems the only way around is to have a exe wrapper. (even if it doesn't seems to be the best solution)
 
Maneesh Godbole
Saloon Keeper
Posts: 11183
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dilshan Edirisuriya:
How to handle this in a java application that has similar behavior(multiple windows) ?


Why do you need to handle it yourself? The OS already handles it for you.
Or are you talking about JDesktopPane and JInternalFrame scenario?
 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Maneesh.

Actually I have 5 separate JFrames in my application. So once i click on the close group button a message should popup asking user to save. But now when I click on the close group it happens only to a one frame not all 5 frames.

For my second issue I found a forum post. Check this.

http://forums.sun.com/thread.jspa?threadID=541940

According to this when I modify the registry entry It takes effect to the all applications which runs on the JRE. So without bundling my application in a separate JRE is there any solution?
 
Maneesh Godbole
Saloon Keeper
Posts: 11183
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using a window listener and windowClosing() prompting the user to save? (The setDefaultCloseOperation should be set to DO_NOTHING_ON_CLOSE (default) )
I tried it and got prompted 5 times. How are you checking for window closing?

Of course this is not the only way. You can use Runtime#addShutdownHook(Thread hook) for example.

I don't see how the solution for the second problem can run on non Windoze platforms.
[ September 10, 2008: Message edited by: Maneesh Godbole ]
 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Maneesh

But that is not the actual scenario I want to handle. When we have multiple windows GROUPED as a single window, when we right click there is an close group option. So close group expected behavior is to close all the windows. But in my case it only affects to only one window.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic