JDK-8225556 : Problem with undecorated Frame on macOS
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 11,12
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2019-06-05
  • Updated: 2019-06-11
  • Resolved: 2019-06-11
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Mojave with java 12

A DESCRIPTION OF THE PROBLEM :
If u try to minimize an undecorated frame it doesn't work

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class SwingFrameState extends JFrame {
    public SwingFrameState() throws HeadlessException {
        initUI();
    }

    private void initUI() {
        setUndecorated(true);           
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setLayout(new FlowLayout());

        final JButton minimize = new JButton("Minimize");
        final JButton maximize = new JButton("Maximize");
        final JButton normal = new JButton("Normal");

        add(normal);
        add(minimize);
        add(maximize);

        pack();
        setSize(500, 200);

        ActionListener listener = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (e.getSource() == normal) {
                    setExtendedState(Frame.NORMAL);
                } else if (e.getSource() == minimize) {
                    setExtendedState(Frame.ICONIFIED);
                } else if (e.getSource() == maximize) {
                    setExtendedState(Frame.MAXIMIZED_BOTH);
                }
            }
        };

        minimize.addActionListener(listener);
        maximize.addActionListener(listener);
        normal.addActionListener(listener);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                new SwingFrameState().setVisible(true);
            }
        });
    }
}


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
a minimizable popup
ACTUAL -
it doesn't work as expected

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

public class SwingFrameState extends JFrame {
    public SwingFrameState() throws HeadlessException {
        initUI();
    }

    private void initUI() {
        setUndecorated(true);           
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setLayout(new FlowLayout());

        final JButton minimize = new JButton("Minimize");
        final JButton maximize = new JButton("Maximize");
        final JButton normal = new JButton("Normal");

        add(normal);
        add(minimize);
        add(maximize);

        pack();
        setSize(500, 200);

        ActionListener listener = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (e.getSource() == normal) {
                    setExtendedState(Frame.NORMAL);
                } else if (e.getSource() == minimize) {
                    setExtendedState(Frame.ICONIFIED);
                } else if (e.getSource() == maximize) {
                    setExtendedState(Frame.MAXIMIZED_BOTH);
                }
            }
        };

        minimize.addActionListener(listener);
        maximize.addActionListener(listener);
        normal.addActionListener(listener);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                new SwingFrameState().setVisible(true);
            }
        });
    }
}

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

CUSTOMER SUBMITTED WORKAROUND :
no one

FREQUENCY : always



Comments
Rechecked and confirmed that the issue does no reproducible with JDK 13 ea build. Closing this as a duplicate of JDK-8214046 which has fix in JDK 13.
11-06-2019

It looks similar to JDK-8214046 which was fixed in jdk13b21. I have tested the current jdk13 on macOS 10.13 and it works properly(I am able to reproduce the bug on jdk12), please confirm that the bug is fixed or it is specific to macOS Mojave 10.14
11-06-2019

Undecorated frame fails to minimize in macOS Mojave with JDK 12. Issue is reported with JDK 12 and macOS MOjave. When checked, confirmed that this is a regression in JDK 11. Issue is restriced to macOS as it works fine with Windows. Result: ========= 8u211: Ok 9: Ok 10.0.2: Ok 11: Fail 12: Fail 13 ea b24: Fail To verify, run the attached test case with respective JDK version and select click on minimize. In case of JDK 10 and below it work fine, but fails with JDK 11 and above including JDK 13 ea build.
11-06-2019