简体   繁体   English

Netbeans Java应用程序-更改应用程序的标题或名称

[英]Netbeans Java application - change title or name of application

When I run my app (in Netbeans) the title of the app (in the top left corner of my OS) is the name of the java class (not the name I want or the name of the project). 当我运行我的应用程序(在Netbeans中)时,应用程序的标题(在操作系统的左上角)是java类的名称(而不是我想要的名称或项目的名称)。

If there a way to change this so it is more meaningful? 如果有办法改变这一点,那么它更有意义吗? I am sure there should be but I can't seem to find out how.. 我确定应该有,但我似乎找不到答案。

I can change the title of the window that opens but I want the name in the top left corner to be different (ie the programs name). 我可以更改打开的窗口的标题,但我希望左上角的名称不同(即程序名称)。

Hope this is clear? 希望这清楚吗?

Thanks 谢谢

EDIT WITH SCREENSHOT 用屏幕编辑

在此处输入图片说明

OK in this pic the app is running in the foreground and Netbenas behind. 在此图片中,该应用程序在前台运行,而Netbenas在后面运行。

You can see the name I want changed is 'photosjFrame' - to something more meaningful for my app like "Photo Databse" etc etc 您可以看到我想要更改的名称是“ photosjFrame”-对我的应用程序来说更有意义,例如“ Photo Databse”等

Hope this makes sense now… 希望这现在有意义...

Thanks 谢谢

UPDATE 2 更新2

Here is another screenshot that I hope makes sense… 这是我希望有意义的另一个屏幕截图...

在此处输入图片说明

I have tried: 我努力了:

super("Some meaningful title");

and

 super("Some meaningful title"); 

but as you can see from the screen shot they change the title of the window open not of the application name (or whatever it is called)… 但是从屏幕截图中可以看到,它们更改了打开的窗口的标题,而不更改了应用程序名称(或其他名称)…

Thanks 谢谢

Although your question is not as clear as it could be, and the screenshot still doesn't really show us what you desire, is it not as simple as calling...: 尽管您的问题并不尽如人意,并且屏幕截图仍未真正向我们显示您的期望,但是它不像调用...那样简单:

this.setTitle("Some meaningful title");

from within the jframe code, or...: 从jframe代码中,或者...:

yourFrame.setTitle("Some meaningful title");

from wherever else is appropriate... 从其他合适的地方...

To change what text is shown in the Mac taskbar (top left), try adding the following lines: 要更改Mac任务栏中(左上角)显示的文本,请尝试添加以下几行:

System.setProperty("apple.laf.useScreenMenuBar","true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Some meaningful name"); 
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

Or, in newer versions of Java I beleive you can either: 或者,我相信在较新版本的Java中,您可以:

  1. Use the -XDock:name functionality 使用-XDock:name功能
  2. Set CFBundleName in the information property list. 在信息属性列表中设置CFBundleName。 See this link: 看到这个链接:

See https://developer.apple.com/library/mac/documentation/Java/Conceptual/Java14Development/07-NativePlatformIntegration/NativePlatformIntegration.html 参见https://developer.apple.com/library/mac/documentation/Java/Conceptual/Java14Development/07-NativePlatformIntegration/NativePlatformIntegration.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM