是否有编程替代方法来设置 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 不同的类中.main()
method in a separate class from the JFrame.例如:
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 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!