How to change the Java application name shown in the Mac OS X launchpad

前端 未结 4 2030
予麋鹿
予麋鹿 2021-02-20 07:33

When my application written in Java with SWT runs under OS X, both from under Eclipse and from jar, its name in

4条回答
  •  醉话见心
    2021-02-20 08:00

    You should do the following during app initialization, before GUI is built:

    // 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", "AppName");
    
    // set the look and feel
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    

    But above code works in Java 1.5, this code may not work in 1.6

    For new java see documentation:

    1. Either use -Xdock:name command-line property:-Xdock:name=YourAppName
    2. Or set CFBundleName in information property list file (plist)

提交回复
热议问题