JDK-6321258 : JDialog stays visible after it was hidden.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-09-08
  • Updated: 2005-09-09
  • Resolved: 2005-09-09
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP

A DESCRIPTION OF THE PROBLEM :
If the JDialog has a JFrame as a parent, and the dialog also is not modal,
perform following
1. minimize parent frame
2. hide JDialog (from the code)
3. maximaze parent frame
4. hidden JDialog stays be visible


Note: I need to keep the dialog to be not modal

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
please use following code:


public static void main(String[] args) {
     JFrame frame = new JFrame();
    frame.getContentPane().add(new JPanel());
    frame.setSize(new Dimension(400,400));
    frame.setDefaultCloseOperatio(WindowConstants.EXIT_ON_CLOSE);

    final JDialog waitDialog = new JDialog(frame, "Wait Dialog");
    waitDialog.setSize(new Dimension(100,100));
    waitDialog.setModal(false);

    frame.addWindowListener(new WindowListener(){
      public void windowOpened(WindowEvent windowEvent) {
      }

      public void windowClosing(WindowEvent windowEvent) {
      }

      public void windowClosed(WindowEvent windowEvent) {
      }

      public void windowIconified(WindowEvent windowEvent) {
        try {
            Thread.sleep(5);
            waitDialog.hide();
          }
          catch (InterruptedException ex) {
            waitDialog.hide();
          }
      }

      public void windowDeiconified(WindowEvent windowEvent) {
      }

      public void windowActivated(WindowEvent windowEvent) {
      }

      public void windowDeactivated(WindowEvent windowEvent) {
      }
    });
    frame.show();
    waitDialog.show();
  }


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
after frame maximization the dialog should disappear.
ACTUAL -
the dialog doesn't disappear

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Frame1 extends JFrame {

  public Frame1() {
  }
  public static void main(String[] args) {
    Frame1 frame = new Frame1();
    frame.getContentPane().add(new JPanel());
    frame.setSize(new Dimension(400,400));
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

    final JDialog waitDialog = new JDialog(frame, "Wait Dialog");

    waitDialog.setSize(new Dimension(100,100));
    waitDialog.setModal(false);
    
    frame.addWindowListener(new WindowListener(){
      public void windowOpened(WindowEvent windowEvent) {
      }

      public void windowClosing(WindowEvent windowEvent) {
      }

      public void windowClosed(WindowEvent windowEvent) {
      }

      public void windowIconified(WindowEvent windowEvent) {
        try {
            Thread.sleep(5);
            waitDialog.hide();
          }
          catch (InterruptedException ex) {
            waitDialog.hide();
          }
      }

      public void windowDeiconified(WindowEvent windowEvent) {
      }

      public void windowActivated(WindowEvent windowEvent) {
      }

      public void windowDeactivated(WindowEvent windowEvent) {
      }
    });
    frame.show();
    waitDialog.show();
  }
}
---------- END SOURCE ----------