Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2005

Tip: Looking for answers? Try searching our database.

Dialogs always on the top

Thread view: 
Sameer - 28 Aug 2005 18:17 GMT
The dialogs created with JOptionPane are modal dialogs
and each showXxxDialog method of JOptionPane blocks the
current thread until the user's interaction is complete.

But how to make them to be always on top of the owner?

I have got a problem related to this functionality:

In my Chat Application the owner of a dialog is a frame.
Suppose that the close button of the frame initiates a dialog and
when this dialog is active, another event happens which let the
frame got the focus, in this situation, the dialog disappers (goes
behind the frame) and frame was not in a position to receive any
input though it has focus.

Please suggest remedy for the same.
-Sameer
jan V - 28 Aug 2005 18:46 GMT
> Please suggest remedy for the same.

Before your program pops up the dialog, broadcast an event to all your
focus-able components that they should refuse the focus. If that scheme
doesn't work, find another way of basically making it impossible for the
focus to leave your dialog.
Babu Kalakrishnan - 28 Aug 2005 19:19 GMT
> The dialogs created with JOptionPane are modal dialogs
> and each showXxxDialog method of JOptionPane blocks the
[quoted text clipped - 12 lines]
>
> Please suggest remedy for the same.

Are you sure you're setting the parent component for the JOptionPane
correctly ? As far as I can recall, if you set the parent correctly, the
dialog does stay on top of the parent.

BK
Sameer - 28 Aug 2005 19:48 GMT
Sorry sir, but i observed that my the JOptionPane.showXX .... method
was wrapped in another  method  which is passing 'null' as the
parameter for the Component and not the parent and that's why it may be
not working.
Babu Kalakrishnan - 29 Aug 2005 05:04 GMT
> Sorry sir, but i observed that my the JOptionPane.showXX .... method
> was wrapped in another  method  which is passing 'null' as the
> parameter for the Component and not the parent and that's why it may be
>  not working.

The certainly would be the cause. The "component" parameter of the
showXX is the one from which the shown dialog's parent is derived - The
parent would be set as the Top level window in which the specified
component is located.

BK


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.