0

I have tried to follow the instructions to make Java Swing application to look like Mac OSX application. However, these are a bit outdated.

The properties

System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "My App");

don't seem to do anything.

MRJApplicationUtils as instructed here is deprecated, but it seems to work

com.apple.mrj.MRJApplicationUtils.registerAboutHandler(
  new com.apple.mrj.MRJAboutHandler() {

    @Override
    public void handleAbout() {
      showAbout();
  }
});

(Edit) (And this even compiles in other OSes, if you just add empty 'MRJ' stub classes to your project.)

So what are the current recommendations to prepare for OSX in Java 8/OpenJDK? Namely I would like to still enable renaming my app properly and to move the main menu to the Mac Menubar. As mentioned, About box can be handled, but seems it is not recommended as I've done it.

(Edit) BTW: I am now using Nimbus Look and Feel, but it seems that these issues didn't work any better with Aqua.

(Edit) Naming the app is instructed here

Jouni Aro
  • 1,867
  • 11
  • 27
  • 1
    May be this https://stackoverflow.com/questions/5688518/substance-and-macos-menubar ? – Jean-Baptiste Yunès Aug 22 '17 at 16:20
  • @Jean-BaptisteYunès Yes, that 'menuBar.setUI()' did the trick! – Jouni Aro Aug 23 '17 at 06:50
  • Now the only uncertain issue here is the registerAboutHandler(), which is deprecated, although it works. I assume there is a better alternative for that as well... – Jouni Aro Aug 23 '17 at 06:52
  • Hmm, the About box is used, if I run the app from Eclipse. But when installed as a proper application to OSX Sierra from the .dmg, it replaces the dialog with a default one anyways! So, that's why the MRJ classes are deprecated - they don't do the job after all. – Jouni Aro Aug 23 '17 at 07:42

0 Answers0