以编程方式设置 dock:name Java Mac OS X JVM 属性

发布于 2024-08-27 14:53:57 字数 161 浏览 4 评论 0原文

是否有一种编程替代方法可以通过执行以下操作来设置dock:name Java Mac OS X属性

java -Xdock:name="My App Name" -jar myapp.jar

,或者这是设置dock:name属性的唯一方法?

Is there a programatic alternative to setting the dock:name Java Mac OS X property by doing

java -Xdock:name="My App Name" -jar myapp.jar

, or is this the only way to set the dock:name property?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忆梦 2024-09-03 14:53:57

已经有一段时间了,但我相信您需要执行以下操作(假设您使用的是 Swing):

  1. 将您的 main() 方法放在与 JFrame 不同的类中。
  2. 创建 JFrame 之前,请设置“com.apple.mrj.application.apple.menu.about.name”系统属性。

例如:

public class Launcher {
  public static void main(String[] args) {
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Hello World!");
    JFrame jframe = new MyJFrame();
    jframe.setVisible(true);
  }
}

It's been a while, but I believe you need to do the following (this is assuming you're using Swing):

  1. Put your main() method in a separate class from the JFrame.
  2. Before creating the JFrame, set the "com.apple.mrj.application.apple.menu.about.name" system property.

For example:

public class Launcher {
  public static void main(String[] args) {
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Hello World!");
    JFrame jframe = new MyJFrame();
    jframe.setVisible(true);
  }
}
╭⌒浅淡时光〆 2024-09-03 14:53:57

Apple 扩展记录如下:
http:// developer.apple.com/mac/library/documentation/Java/Reference/1.5.0/appledoc/api/overview-summary.html

我查看了 com.apple.eawt.Application ,这使您可以访问图标和菜单...但不幸的是,不能访问标题。

我猜测规定的方法是推出您自己的应用程序包,如下所示: http://developer.apple.com/Mac/library/documentation/Java/Conceptual/Java14Development/03-JavaDeployment/JavaDeployment.html

The Apple extensions are documented here:
http://developer.apple.com/mac/library/documentation/Java/Reference/1.5.0/appledoc/api/overview-summary.html

I looked at com.apple.eawt.Application, which gives you access to the icon and menus... but not title, unfortunately.

I am guessing the prescribed approach is to roll out your own App Bundle, as detailed here: http://developer.apple.com/Mac/library/documentation/Java/Conceptual/Java14Development/03-JavaDeployment/JavaDeployment.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文