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

JFrame in full screen mode leaves empty workspace after close

XMLWordPrintable

    • b36
    • os_x

        FULL PRODUCT VERSION :
        java version "1.8.0-ea"
        Java(TM) SE Runtime Environment (build 1.8.0-ea-b120)
        Java HotSpot(TM) 64-Bit Server VM (build 25.0-b62, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Mac OS X 10.9

        A DESCRIPTION OF THE PROBLEM :
        The problem reproduces on both JDKs 1.7.0_45 and 1.8.0-ea-b120

        If you have two or more JFrames in full screen mode and close one of the frames, there will be an empty grey screen and empty toolbar menu.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. Open IntelliJ IDEA
        2. Open two or more projects
        3. Send all windows to full screen
        4. Close one of the projects by Main Menu -> File -> Close project

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Empty workspace should be removed from available spaces.
        ACTUAL -
        Grey empty screen

        REPRODUCIBILITY :
        This bug can be reproduced always.

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

        /**
         * @author Konstantin Bulenkov
         */
        public class MacWorkspacesBug extends JFrame {
          public MacWorkspacesBug(String title) throws HeadlessException {
            super(title);
            setSize(500, 500);

            final JButton close = new JButton("Close");
            close.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                setVisible(false);
              }
            });
            getContentPane().add(close);
          }

          public static void enableOSXFullscreen(Window window) {
            try {
              Class<?> util = Class.forName("com.apple.eawt.FullScreenUtilities");
              Method method = util.getMethod("setWindowCanFullScreen", Window.class, Boolean.TYPE);
              method.invoke(util, window, true);
            } catch (Exception ignore) {
            }
          }

          public static void main(String[] args) {
            final MacWorkspacesBug f1 = new MacWorkspacesBug("Frame 1");
            final MacWorkspacesBug f2 = new MacWorkspacesBug("Frame 2");
            enableOSXFullscreen(f1);
            enableOSXFullscreen(f2);
            f1.setVisible(true);
            f2.setVisible(true);
          }
        }

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

              serb Sergey Bylokhov
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: