如何命名应用程序并给它一个图标? [英] How to name application and give it an icon?
问题描述
优先的方法是创建一个 Mac OS应用程序包(和 bundler ),但是如果这似乎很多工作,您可以提供自定义属性,例如,您可以提供 Xdock:name
-DXdock:name =应用程序名称
如果你不能这样做,你可以在应用程序运行时进行设置。
public static void main(String [] args){
try {
// Sets菜单栏上的应用程序名称
System.setProperty(Xdock:name,Application Name);
//设置应用程序停靠图标...
应用程序应用程序= Application.getApplication();
application.setDockIconImage(ImageIO.read(TestDockIcon.class.getResource(/ Icon.png)));
//启动应用程序...
new TestDockIcon();
} catch(IOException exp){
exp.printStackTrace();
}
}
I'm working in eclipse and I have made an application without name and icon. When i start the application it's a really creepy name displaying in the upper left corner (Mac). It's some thing like. I wonder how I can change this to my own name. Second question is how i can change the icon. Can I do that in eclipse?
The prefered method would be to create a Mac OS application bundle (and the bundler), but if this seems like to much work, you can supply custom properties to, for example, you could supply the Xdock:name
property when running the application, for example...
-DXdock:name="Application Name"
If you can't do that, you can set it when your application runs, for example...
public static void main(String[] args) {
try {
// Sets the application name on the menu bar
System.setProperty("Xdock:name", "Application Name");
// Set the applications dock icon...
Application application = Application.getApplication();
application.setDockIconImage(ImageIO.read(TestDockIcon.class.getResource("/Icon.png")));
// Start the application...
new TestDockIcon();
} catch (IOException exp) {
exp.printStackTrace();
}
}
这篇关于如何命名应用程序并给它一个图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!