目录

我的学习分享

记录精彩的程序人生

Get the application title inside your platform application

https://layerxml.wordpress.com/2011/02/22/get-the-application-title-inside-your-platform-application/

I’m adding some information into the platform applications title bar and I have hard coded the application name title in one of my classes. This works but when the application name changes (for example version/release number) I have to remember to change in two places (my class and in the branding dialog box).

Today I finally did have a look how to get the application title in my code and it was this simple:

NbBundle.getBundle("org.netbeans.core.windows.view.ui.Bundle").getString("CTL_MainWindow_Title");

And to set the titlebar of the application:

SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
WindowManager.getDefault().getMainWindow().setTitle(NbBundle.getBundle("org.netbeans.core.windows.view.ui.Bundle").getString("CTL_MainWindow_Title") + " - " + myOtherInformationIWantInTheTitleBar);
});