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

JDialog does not disappear with setVisible(false) when changing workspace

XMLWordPrintable

    • b09
    • x86, sparc
    • linux, solaris_10
    • Verified

      FULL PRODUCT VERSION :
      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Linux elrond.service.jet.msk.su 2.6.13-1.1532_FC4smp #1 SMP Thu Oct 20 01:51:51 EDT 2005 i686 i686 i386 GNU/Linux

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Reproduced on Metacity window manager (2.10.3-1) and IceWM (1.2.22-2).

      A DESCRIPTION OF THE PROBLEM :
      The frame creates new JDialog. After a sleep application closes JDialog with setVisible(false) and dialog authomaticly disappears. This goes ok if you keep in your current workspace.

      If you start a new frame, change to another workspace and do not come back before you sure that the dialog should diappear (setVisible(false) call should happen when you are on another workspace). When you back you will see "idle" dialog that does not repaint itself and cannot be closed. You still can resize or move it.

      It is possible to use the dialog again by calling setVisible(true) or remove it with dispose() call.

      I found the similar bug #6203528

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Run sample program. It will show a Frame and Dialog
      2) Switch to another workspace as fast as possible (dialog will be hidden in 5 seconds)
      3) Wait ~10 seconds and return to workspace where you have the Frame
      4) You will see the Frame and the Dialog. Dialog stays on screen but does not paint itself


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Dialog should be hidden even if you are on another workspace
      ACTUAL -
      Dialog stays on screen when you are on another workspace. Dialogs hides when you are do not change workplace

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      public class DialogTestFrame extends JFrame {
        public DialogTestFrame() {
          JLabel lbl = new JLabel("TEST FRAME");
          getContentPane().add(lbl);

          setSize(300, 300);
        }

        protected void processWindowEvent(WindowEvent e) {
          if (e.getID() == WindowEvent.WINDOW_CLOSING) {
            System.exit(0);
          }

          super.processWindowEvent(e);
        }

        public static void main(String argv[]) throws InterruptedException {
          DialogTestFrame frame = new DialogTestFrame();

          JDialog testDialog = new JDialog(frame);
          JLabel label = new JLabel("Dialog label");
          testDialog.getContentPane().add(label);
          testDialog.pack();

          frame.setVisible(true);

          testDialog.setVisible(true);

          Thread.sleep(5000);

          testDialog.setVisible(false);
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      It is possible to close the dialog with dispose() method call. But sometimes dialog stays on screen even after that, but it happens rarely and I cannot reproduce it.

      We have this problem with status dialog, that it shown/hidden many times in our application. We can displose() and recreate dialog, but it is not solution. Sometimes dialog stays on screen even after dispose() call. When we use setVisible("true")/setVisible("false") we have only one "dead" dialog. When we use dispose()/recreate technique we have several "dead" dialogs after a few hours and this is more annoying that one dialog that hides on next hide/show cycle.

            yan Yuri Nesterenko
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: