本文介紹了以編程方式設(shè)置 dock:name Java Mac OS X JVM 屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
限時送ChatGPT賬號..
是否有編程替代方法來設(shè)置 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
,或者這是設(shè)置 dock:name 屬性的唯一方法?
, or is this the only way to set the dock:name property?
推薦答案
已經(jīng)有一段時間了,但是我相信您需要執(zhí)行以下操作(這是假設(shè)您使用的是 Swing):
It's been a while, but I believe you need to do the following (this is assuming you're using Swing):
- 將您的
main()
方法放在與 JFrame 不同的類中. - 在創(chuàng)建 JFrame 之前,設(shè)置com.apple.mrj.application.apple.menu.about.name"系統(tǒng)屬性.
- 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);
}
}
這篇關(guān)于以編程方式設(shè)置 dock:name Java Mac OS X JVM 屬性的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!