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 / December 2004

Tip: Looking for answers? Try searching our database.

Active dialog not on top

Thread view: 
laura p - 20 Dec 2004 15:58 GMT
Hi,

I have a requirement for my current system to support 'always on top'
dialogs.  So far I can't find any way to achieve this in Java.

The ideal behaviour would be similar to that which occurs in MS Word
when doing a Find or Replace - i.e. the search dialog appears and stays
visible, but the Word document underneath can get focus and become
active.

The problem seems to be, if the dialog is modal, it must be closed
before you can return to the owner frame.  Alternatively, if the dialog
is not modal, when the owner frame is activated, the dialog goes behind
the window.
If anyone can provide help with this it would be great!

Thanks,
Laura
Andrei Kouznetsov - 20 Dec 2004 16:29 GMT
> The problem seems to be, if the dialog is modal, it must be closed
> before you can return to the owner frame.  Alternatively, if the dialog
> is not modal, when the owner frame is activated, the dialog goes behind
> the window.

wrong! dialog goes never behind his owner.
(ok it goes sometimes behind his owner - if you switch to another app and
back,
this is however bug)

> The ideal behaviour would be similar to that which occurs in MS Word
> when doing a Find or Replace - i.e. the search dialog appears and stays
> visible, but the Word document underneath can get focus and become
> active.
this is non-modal dialog

Signature

Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities

Chas Douglass - 20 Dec 2004 21:43 GMT
"laura p" <laura.paterson@gmail.com> wrote in news:1103558305.194739.271260
@z14g2000cwz.googlegroups.com:

> Hi,
>
[quoted text clipped - 14 lines]
> Thanks,
> Laura

Java 5/1.5.0 added a Window#setAlwaysOnTop().  Prior to that is was
difficult, if not impossible.

Chas Douglass
laura p - 21 Dec 2004 10:00 GMT
Thanks very much, haven't moved to Java 5 yet, so this is a good excuse
to try it out!
Cheers, Laura

> Java 5/1.5.0 added a Window#setAlwaysOnTop().  Prior to that is was
> difficult, if not impossible.
laura p - 21 Dec 2004 16:40 GMT
> > Java 5/1.5.0 added a Window#setAlwaysOnTop().  Prior to that is was
> > difficult, if not impossible.

After writing a quick noddy to test this behaviour, I have found that
setting Window#setAlwaysOnTop to true or false makes no difference to
whether or not the dialog stays on top of its owner - in 1.5 it appears
the bug that was causing the child dialog to go behind has been fixed.

Using Window#setAlwaysOnTop will cause the dialog to stay on top of
other applications, if the OS supports it:

API Spec: "Changes the always-on-top window state. An always-on-top
window is a window that stays above all other windows except maybe
other always-on-top windows. If there are several always-on-top windows
the order in which they stay relative to each other is not specified
and is platform dependent."
Thanks for the help I received with this problem!
Andrei Kouznetsov - 21 Dec 2004 17:28 GMT
> After writing a quick noddy to test this behaviour, I have found that
> setting Window#setAlwaysOnTop to true or false makes no difference to
> whether or not the dialog stays on top of its owner - in 1.5 it appears
> the bug that was causing the child dialog to go behind has been fixed.

as I already said this is the bug, you can fix it very easy
if you just adds WindowListener to your (J)Frame/(J)Window and on
windowActivated() event
calls frame.getOwnedWindows and for every window calls toFront().

Signature

Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities



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.