• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modal JOptionPanes and Taskbar problem?

 
myron schabe
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a big java application that is comprised of several frames for different business functions. The app throws errors and warnings with modal JOptionPanes - very normal/standard right. I am having a problem, though, with the task bar in that if some of my frames are minimized on the task bar - and one of my maximized frames pops up a modal JoptionPane - the modal JOptionPane can get covered over by the maximizing of a minimized frame. Has anyone else seen this problem and if so - what is the fix?
(The resulting situation is the app seems to lock up because the user can't find the modal dialog.)
Many Thanks
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you creating the modal error dialogs using the constructor that lets you pass a parent frame in? If you click on the parent frame's button on the taskbar, the modal dialog should come up instead...

If you have multiple frames up at one time, and dialogs to be modal to all of them, you'll want to look into using a JDesktopPane and JInternalFrames, so that your application only has one main frame that the dialog can be modal to.
 
Bill Liteplo
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think we battled this same problem at my company.
I might be able to find the code that fixed it...
...but I won't be at work again until Tuesday.
Bill
 
myron schabe
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To Nate:
Yes, I am creating the JOptionPane with one of the various frames as a parent.
But can you, using the JDesktopPane and JInternalFrames model, have 'free floating' frames - because I don't want to have frames embedded within one outer encompassing frame(ala mdi).
And, yes, most of the time when you click on the parent frame's button on the taskbar the modal comes up on top of parent frame - but I have seen it slip behind the parent in some cases - but moreover I am getting complaints that even when it works correctly( when modal appears on top of the parent frame upon maximization )it is confusing for a user. So, I am looking for a possible work around.

To Bill:
Yes, if you have sample code that would be great - I am not in dire straits with time.
 
Bill Liteplo
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked around a bit in our ChangeLogs. The only changes I noticed having to do with dialogs is that we became consistent about invoking the constructor with a Frame parent argument, and also by setting the dialog modal in some cases.
Also, we tended to instantiate a new dialog every time we wanted to show one, instead of creating one and show/hiding it appropriately. There are ways to get around the size-and-shape-me-like-the-last-time-I-was-shown problem (just cache that info yourself if you really need it).
I think that's all I have on this issue. We never used internal frames, so I can't help you with that specifically.
Good luck,
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic