Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Custom_JDialog

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Custom_JDialog

    Hello,

    I have very specific issue and need help on how to solve it.

    Say we have main frame and two dialogs A and B. Main frame is owner of A and A is owner of B.

    I would like to have dialog or frame C which will be non-modal and always on top,
    no matters where user is (on main frame, dialog A or B). Also dialog C should
    always exist (while main frame exist).

    If i make main frame to be owner of C and set always on top to C then everything
    will be fine, except when we are on A or B. If user is on dialog A or B and clicks on
    dialog C, dialog C will disappear and go behind .
    If i make dialog A or B as owner of C then when i close dialog A or B, dialog C
    will also be closed.

    Maybe i am going to wrong direction, and hopefully someone have another idea how to achieve this.

    Best regards.

  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Custom_JDialog

    If you want it to be always on top of all frames (even those from other applications) you can use the setAlwaysOnTop() method.

    frameC.setAlwaysOnTop(true);

    I don't think there's any mechanism for changing the z-order of JFrames and JDialogs other than toFront() or toBack(), though (both of these methods change the focus of the window).

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Custom_JDialog

    Hi,

    I was already set always on top to C, but i forgot to set modal to false to all child dialogs and that was problem. Now i got dialog always on top of all other frames and dialogs.

    Best regards.