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

[macosx] Help menu does not appear as a help menu unless the name is Help

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.8.0_05"
      Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.9.2

      A DESCRIPTION OF THE PROBLEM :
      When using the screen menu bar functionality on Mac OS X, if the title of your help menu is Help, Java or Mac OS (can't tell which) adds additional features to the menu to make it behave like a proper Mac OS X help menu. For instance, it enables the search box to search for menu actions.

      However, if the title of your help menu is anything else (which it is likely to be if you're not using an English application), it lacks these additional items, no longer looking anything like a proper help menu.

      Aside from not working with JMenuBar, what's even more surprising is that it doesn't work with MenuBar either, even though it has a method specifically for indicating which menu is the help menu.



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.JFrame;
      import javax.swing.JMenu;
      import javax.swing.JMenuBar;
      import javax.swing.SwingUtilities;
      import javax.swing.WindowConstants;

      public class HelpMenuTest implements Runnable {
          public static void main(String[] args) {
              SwingUtilities.invokeLater(new HelpMenuTest());
          }

          @Override
          public void run() {
              System.setProperty("apple.laf.useScreenMenuBar", "true");

              JFrame frame = new JFrame();

              // Works:
      // JMenuBar menuBar = new JMenuBar();
      // JMenu helpMenu = new JMenu("Help");
      // menuBar.add(helpMenu);
      // frame.setJMenuBar(menuBar);

              // Doesn't work:
              JMenuBar menuBar = new JMenuBar();
              JMenu helpMenu = new JMenu("Hilfe");
              menuBar.add(helpMenu);
              frame.setJMenuBar(menuBar);

              // Doesn't work either (odd, because I specifically told it which one was the help menu.)
      // MenuBar menuBar = new MenuBar();
      // Menu helpMenu = new Menu("Hilfe");
      // menuBar.add(helpMenu);
      // menuBar.setHelpMenu(helpMenu);
      // frame.setMenuBar(menuBar);

              frame.setSize(200, 200);
              frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              frame.setVisible(true);
          }
      }

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

        1. Deutsch_Without_Search.png
          13 kB
          Damon Nguyen
        2. English_With_Search.png
          23 kB
          Damon Nguyen

            dnguyen Damon Nguyen
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: