3

I want to change the title of my java app on the osx menubar from the class name. I've tried putting this at the top of my main method but it does not work.

System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("apple.awt.application.name", "app name");
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Do I need a special library or something?

1 Answers1

3

What you are doing looks correct, but you need to do it before any of your UI/window is created or AWT classes are loaded.

See this post: https://stackoverflow.com/a/33489386/1270000

Edit: note that behavior may be different when running your code in an IDE. So compile your code and test it rather than running directly from your IDE.

Community
  • 1
  • 1
sorifiend
  • 5,927
  • 1
  • 28
  • 45