Programmatically setting the dock:name Java Mac OS X JVM property(以编程方式设置 dock:name Java Mac OS X JVM 属性)
问题描述
是否有编程替代方法来设置 dock:name Java Mac OS X 属性
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
,或者这是设置 dock:name 属性的唯一方法?
, or is this the only way to set the dock:name property?
推荐答案
已经有一段时间了,但是我相信您需要执行以下操作(这是假设您使用的是 Swing):
It's been a while, but I believe you need to do the following (this is assuming you're using Swing):
- 将您的
main()方法放在与 JFrame 不同的类中. - 在创建 JFrame 之前,设置com.apple.mrj.application.apple.menu.about.name"系统属性.
- Put your
main()method in a separate class from the JFrame. - Before creating the JFrame, set the "com.apple.mrj.application.apple.menu.about.name" system property.
例如:
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);
}
}
这篇关于以编程方式设置 dock:name Java Mac OS X JVM 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:以编程方式设置 dock:name Java Mac OS X JVM 属性
基础教程推荐
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
