Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6888200

Owner frame should be activated on closing a modal dialog.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 7
    • 6u20-rev, 7
    • client-libs
    • None
    • x86, sparc
    • solaris_10, windows

        The problem was originally reported here:

        http://forums.java.net/jive/thread.jspa?messageID=366737

        THE PROBLEM:

        Closing modal dialog doesn't activate its owner.

        HOW TO REPRODUCE:

        Compile and run the testcase below.

        1. Two frames and one dialog will appear. Make sure the dialog is focused.
        2. Alt-tab to the frame "f0".
        3. Alt-Tab to the dialog again.
        4. Close the dialog.

        EXPECTED BEHAVIOR:

        The frame "f1" (the owner of the dialog) gets activated.

        ACTUAL BEHAVIOR:

        The previously active frame "f0" gets activated.


        Note that this works fine on Linux.

        =======================================================================
        import java.awt.*;
        import javax.swing.*;

        public class Test {

        public static void main(String[] args) {
        JFrame f0 = new JFrame("f0");
        JFrame f1 = new JFrame("f1");
        JDialog d = new JDialog(f1);

        d.setModalityType(JDialog.ModalityType.DOCUMENT_MODAL);

        f0.add(new JButton("frame0"));
        f1.add(new JButton("frame1"));
        d.add(new JButton("dialog"));

        f1.setLocation(200, 0);
        d.setLocation(0, 200);

        f0.pack();
        f1.pack();
        d.pack();

        f0.setVisible(true);
        f1.setVisible(true);
        d.setVisible(true);
        }
        }
        =======================================================================

              ant Anton Tarasov (Inactive)
              ant Anton Tarasov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: