JDK-8223399 : Always on top JFrame disappears if Minimise windows into application icon is set
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8,9,12,13
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: os_x
  • CPU: x86
  • Submitted: 2019-05-05
  • Updated: 2022-06-15
  • Resolved: 2022-06-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Description
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



Comments
The issue is not reproducible on JDK 8, 11, 17, 18 and 19 (on macOS 12). Please reopen in case it is reproducible.
15-06-2022

Not reproducible on MacOS 12 and jdk 19, 20. Verified by changing the dock preferences on-the-fly as well.
15-06-2022

macOS specific issue, with always on top JFrame disappearing if Minimise windows into application icon is set. Checked this for reported version and could confirm the issue. Results: ========= 8: Fail 8u202: Fail 8u221: Fail 9: Fail 12: Fail 13 ea b19: Fail Issue is reproducible across JDK 8, 9, 12, 13. To verify follow the steps as below: 1. In macOS X, select the dock preference "Minimise windows into application icon" 2. Run the attached test case 3. Minimise the JFrame 4. Click the application icon to try and restore the JFrame.
06-05-2019