Friday May 16, 2014

From Project to Scenario

One of the powerful features of the NetBeans Platform is its project system. You can include NetBeans modules in your application that let the user choose File | New Project and then the user can begin creating a new project:

The dialog below then opens, where sample templates of your project type can be listed so that the user can get started with it easily:

The details on setting all this up is described in the tutorial, as well as in NetBeans Platform for Beginners.

However, what if we don't like the word "Project"? Instead, we want the word to be "Scenario", throughout all the UI of our application, in each menu item and dialog? Simply right-click the application and choose Branding:

In the Branding dialog, go to "Internationalization Resource Bundles" and then search for the word/s that you want to brand, e.g., "New Project":

Then a search is done through all the strings in the NetBeans Platform, which are all found in properties files. Each matching string can be right-clicked, as shown above, at which point you can type in a different word.

All changes you make are shown in bold:

After you click OK in the dialog above, open the Files window, expand the 'branding' folder of your application, and you will find that new properties files have been created, in a folder structure matching the folder structure where the original key/value pairs are found.

When you build the application, you'll find that a JAR is added for each NetBeans module that you have overridden with your branded words:

And now your words will override those from the NetBeans Platform. For example, you'll see "Scenario" everywhere, instead of "Project".

One small 'gotcha' is to be aware of the ampersands:

In other words, if you search for "New Project", you will not find your words if they have an ampersand (for quick access via accelerator keys that are created for them by the NetBeans Platform Action System).

And that's all, a very simple and effective mechanism for turning the Project system into a Scenario system.


Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« May 2014 »