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

Always on top JFrame disappears if Minimise windows into application icon is set

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      macOS 10.14.4, Java 8u202

      A DESCRIPTION OF THE PROBLEM :
      If the Dock preference "Minimise windows into application icon" is selected and a JFrame that has "always on top" set true is minimised then restored the JFrame disappears after the restore animation completes. It cannot then be shown again.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Select the dock preference "Minimise windows into application icon"
      Run the test case
      Minimise the JFrame
      Click the application icon to try and restore the JFrame

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The window should be restored
      ACTUAL -
      The window goes through the restoration animation, then vanishes and cannot be shown afterwards

      ---------- BEGIN SOURCE ----------
      import java.awt.BorderLayout;
      import java.awt.EventQueue;
      import java.lang.reflect.InvocationTargetException;
      import javax.swing.JFrame;
      import javax.swing.JLabel;

      public class WindowTest {

          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) throws InterruptedException, InvocationTargetException {
              EventQueue.invokeAndWait(new Runnable(){
                      @Override
                      public void run(){
                          WindowTest test = new WindowTest();
                          test.constructAndShowGUI();
                      }
              });
          }
          
          private void constructAndShowGUI(){
              JFrame frame = new JFrame("Window test");
              frame.setAlwaysOnTop(true);
              frame.setLayout(new BorderLayout());
              frame.add(new JLabel("Window minimisation test"), BorderLayout.CENTER);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setVisible(true);
          }
          
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Set always on top to false

      FREQUENCY : always


            honkar Harshitha Onkar
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: