|
Putting the JMenuBar on the Mac menu barNow that you know your Java/Swing application is running on the Mac, the next step is to get the menu bar to look like a Mac application. If you do nothing at all your Swing application JMenuBar is going to be on your application's JFrame, as shown Figure 4.1:
To get the menu bar off the JFrame and onto the Mac menubar, all you need to do is set the system property apple.laf.useScreenMenuBar to true, like this:
System.setProperty("apple.laf.useScreenMenuBar", "true"); Figure 4.2 show that after this one line of code the JMenuBar is now shown on the Mac menu bar for your application:
|