Note that there are some explanatory texts on larger screens.

plurals
  1. PONative Swing Menu Bar Support For MacOS X In Java
    primarykey
    data
    text
    <p>A link that stands out is <a href="http://www.devdaily.com/blog/post/jfc-swing/handling-main-mac-menu-in-swing-application/" rel="noreferrer">http://www.devdaily.com/blog/post/jfc-swing/handling-main-mac-menu-in-swing-application/</a> however the menu bar under Mac OS X displays as the package name as opposed to the application name. I'm using the code in the above link without any luck, so I'm unsure if anything's changed in recent Mac OS versions.</p> <p>Here's an extract:</p> <blockquote> <pre><code>public RootGUI() { super("Hello"); JMenuBar menuBar = new JMenuBar(); JMenu file = new JMenu("File"); JMenuItem item = new JMenuItem("Woah"); file.add(item); menuBar.add(file); setJMenuBar(menuBar); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(100, 100); pack(); setVisible(true); } </code></pre> </blockquote> <pre><code>public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { try { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Test"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); new RootGUI(); } catch(ClassNotFoundException e) { System.out.println("ClassNotFoundException: " + e.getMessage()); } catch(InstantiationException e) { System.out.println("InstantiationException: " + e.getMessage()); } catch(IllegalAccessException e) { System.out.println("IllegalAccessException: " + e.getMessage()); } catch(UnsupportedLookAndFeelException e) { System.out.println("UnsupportedLookAndFeelException: " + e.getMessage()); } } }); } </code></pre> <p>The first menu item on the menu bar should display as "test", unfortunately this isn't the case. The file menu works fine, on the other hand. Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload