Wednesday May 23, 2007
About the About Dialog Box
This is the NetBeans About dialog box that we all know and love:

The question for today is: "How far can we go in deconstructing this dialog box? How far can we break it down to its bare elements and then rebuild it in our own image?"
My image is humble, hence this is the result of the quest outlined above:

Before continuing, please note that the solution is possibly really simple. Just use the XML layer file to hide the menu item that produces the About dialog box, add a new menu item by means of the Action wizard, and then let that new menu item call up a new dialog box. Then create that new dialog box yourself. That's the best and most useful way of going about customizing this dialog box. Just replace it. That's all.
However, assuming you (for some reason) want to keep the About dialog box, but change its contents for your own purposes, here are some pointers:
- Firstly, many things can be changed in the user interface of a module suite project. Create a module suite project, right-click the project node, and choose Properties. You are now in the Project Properties dialog box. In the Build panel, choose the radiobutton that says "Create Standalone Application". Now you can change the application icon, which is shown in the Details tab of the About dialog box. In the Splash Screen panel, you can change the splash screen, which is shown in the About panel of the About dialog box.
- Now you've changed the icon in the Details tab, as well as the content of the About tab in the About dialog box. However, lets go further and change the texts in the "About" and "Details" tabs. Above, you see I've changed them to "Hahaha" and "Hohoho". How to do that? Here you see the two strings you need to redefine in the Bundle.properties file shown below, which is created automatically when you click the radiobutton referred to in the previous step, which creates a standalone application:

- Next, let's think about changing the content of the "Details" tab. In the NetBeans sources, go to this location:
\core\src\org\netbeans\core\actions
There you will find a class called AboutAction. This is what its performAction method provides:
public void performAction () { Splash.showAboutDialog( org.openide.windows.WindowManager.getDefault().getMainWindow (), new org.netbeans.core.ui.ProductInformationPanel () ); }That's the key to the About dialog box. The first argument is the IDE's frame and the second provides the Details tab. So, in my own module I've created my own action, which replaces the menu item that calls up the About dialog box, and this is my performAction, with only the highlighted line below having been changed:
public void performAction() { Splash.showAboutDialog( org.openide.windows.WindowManager.getDefault().getMainWindow(), new org.yourorghere.about.NewJPanel() ); }In other words, I now have a new panel that replaces the Details tab. For this to be possible, you need to import the org.netbeans.core.startup.Splash package, which means that you must declare a dependency on the Startup module.
Note: The Splash class is not public. Use it at your own risk. (A simple way of doing so is to create a dependency on the Startup module's implementation version, instead of its specification version.)
- What if you want to keep the Details tab but change its contents? That's also possible. The Details tab is provided by a panel called ProductInformationPanel, which is found in this location:
\core\src\org\netbeans\core\ui
This is what it looks like, when opened in the IDE:

To change the contents of this panel, look at how the various User Codes above are constructed and override them via branding, as shown for the texts in the About tab and the Details tab.
- Can you add a new tab to the About dialog box? Well, as you can see earlier, the Splash.showAboutDialog() calls up the About dialog box. It takes two arguments, a Frame and a JComponent. Hence, that's the reason why I was able to replace the Details tab, because I simply put a different panel in its place. Clearly, though, no new panels can be added, because only two arguments can be accepted. For this reason, if you want more panels, you will have to create a whole new About dialog box, which probably makes more sense anyway.
Unless I am very much mistaken, I think I've addressed all the possible questions that can possibly be asked in relation to the customization of the About dialog box. I must say, all this could be a lot easier than it is, because the user interface currently doesn't provide much help in this area. Understandably, though, this area of the platform wasn't considered a very high priority when providing user interface support in the platform area, back in 5.0. Hopefully, though, a future set of enhancements in the platform development area will also cover the About dialog box.
May 23 2007, 06:01:15 AM PDT Permalink


