This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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
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.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
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
Joined: Aug 21, 2002
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.
Joined: Oct 16, 2002
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