Setting Java Swing application name on Mac

前端 未结 2 616
粉色の甜心
粉色の甜心 2020-12-28 18:05

I\'m writing a Java Swing application for the Mac using Java 1.6. I\'ve read a number of tutorials that step you through how to better integrate your Java application with

相关标签:
2条回答
  • 2020-12-28 18:15

    On Mac 10.7.5, programatically setting the property will work with with Java 1.6 but not with Java 1.7.

    0 讨论(0)
  • 2020-12-28 18:29

    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());
    

    UPDATE. 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)
    0 讨论(0)
提交回复
热议问题