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

Modal Dialog changes active frame when closed.

XMLWordPrintable

    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      1.6.0_10-rc-b28

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP SP3

      A DESCRIPTION OF THE PROBLEM :
      When some frames are shown and the frame that not last shown is active,
      create modal dialog and close it causes changing active frame.

      It seems to only occurs on Windows system.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Compile and execute sample program.
      - Push [Close] button on dialog.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Active frame is not changed.
      ACTUAL -
      Active frame is changed to recent shown frame.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Button;
      import java.awt.Dialog;
      import java.awt.Frame;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      public final class Test {
        public static void main(final String[] args) {
          final Frame frame1 = new Frame("Frame1");
          frame1.setBounds(0, 0, 300, 300);
          frame1.setVisible(true);

          final Frame frame2 = new Frame("Frame2");
          frame2.setBounds(100, 100, 300, 300);
          frame2.setVisible(true);

          frame1.toFront();

          final Dialog dialog = new Dialog((java.awt.Frame)null, "Dialog", true);

          final Button button = new Button("Close");
          button.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
      dialog.dispose();
      }
            });

          dialog.add(button);
          dialog.pack();

          dialog.setLocationRelativeTo(null);
          dialog.setVisible(true);
        }
      }
      ---------- END SOURCE ----------

            dcherepanov Dmitry Cherepanov
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: