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

[macos] Unified toolbar is broken when in full screen mode

XMLWordPrintable

    • 9
    • x86_64
    • os_x

      FULL PRODUCT VERSION :
      java version "9.0.1"
      Java(TM) SE Runtime Environment (build 9.0.1+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

      macOS Sierra 10.12.6 (16G29)

      A DESCRIPTION OF THE PROBLEM :
      A unified toolbar can be achieved on macOS by setting the client property "apple.awt.brushMetalLook" to true on the root pane of a Frame. This will remove the visual appearance of the title bar.

      When such a frame is now put into full screen mode, the title bar becomes visible again. This breaks the unified appearance of the toolbar.

      REGRESSION. Last worked in version 8u152

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_152-ea"
      Java(TM) SE Runtime Environment (build 1.8.0_152-ea-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 25.152-b05, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Run the test program
      - Put the window in full screen mode by clicking on the green button in the title bar
      - Notice that some sort of title bar appears at the top.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      There should not appear a title bar like band, the window background should remain a smooth gradient.
      ACTUAL -
      There appears some kind of title bar at the top. The window background is no longer a smooth gradient.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Window;
      import java.lang.reflect.Method;

      import javax.swing.JFrame;
      import javax.swing.SwingUtilities;

      public class UnifiedToolbarTest {
      public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
      test();
      }
      });
      }

      private static void test() {
      JFrame frame = new JFrame();
      frame.getRootPane().putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE);

      // The following is needed for JRE 8 an earlier.
      String version = System.getProperty("java.version");
      if (!version.startsWith("9")) {
      try {
      Class<?> fullScreenUtilities = Class.forName("com.apple.eawt.FullScreenUtilities");
      Class<?> setWindowCanFullScreenParams[] = new Class<?>[] { Window.class, boolean.class };
      Method setWindowCanFullScreen = fullScreenUtilities.getMethod("setWindowCanFullScreen",
      setWindowCanFullScreenParams);
      setWindowCanFullScreen.invoke(null, frame, true);
      } catch (Throwable inException) {
      // Nothing to be done.
      }
      }

      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.pack();
      frame.setSize(200, 200);
      frame.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: