Now that the JMenuBar is in the right place, we need to change the name of the first menu in the menu bar (the application menu). If you don't give it a name, it will show the name of your Java class in the place where a Mac application's name is normally shown, which is a no-op for me.
All you have to do to set the menu item name to show your application's name is to add another system property setting:
Figure 5.1 shows that this sets the name of the main menu on the Mac menu bar to "WikiTeX", which is the name of my Java/Swing text editor.
Important note: I was very surprised to learn that the call to set the system look and feel needs to be made after the call to set the application name. If the calls are reversed the application menu shows the Java class name once again.
So, in total, the Java/Swing application I'm developing primarily for use on a Mac OS X system has these three lines of initialization code:
// take the menu bar off the jframe System.setProperty("apple.laf.useScreenMenuBar", "true"); // set the name of the application menu item System.setProperty("com.apple.mrj.application.apple.menu.about.name", "WikiTeX"); // set the look and feel UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());