Netbeans offers a powerful way of modularising a desktop application. In this tutorial we will be creating a simple application. While this tutorial does not showcase many benefits of the netbeans rich client platform (more to come in other tutorials!), it should be enough to get someone started.
Create A New Project
In the file menu select ‘New Project’, then navigate to the Maven folder and choose Netbeans Application :
Select ‘Next’ and enter in a name and location for your project. Other Maven properties may also be entered such as Group Id and version.
In the last screen leave everything as it is :
Netbeans should have created three new projects. They all should have the same name, but are appended differently with –app, -branding and –parent.
This is not actually a flat structure. If you expand the HappyDog-parent, you will see that the other two projects are defined as modules.
This is also reflected in the directory structure :
This is classic Maven inheritance in action. The two sub projects have the parent project defined in the tag. All Maven plugins and dependencies defined in the super project can also be accessed in the sub projects. Also, the parent POM file has the two sub projects listed as modules. Thus the association between parent and children is two way.
Clean and build the parent maven project HappyDog-parent (Right click HappyDog-parent and select ‘Clean and Build’). This action will also do the same to the sub modules.
You will often get an error when you first do this. This is because the RCP Archetype includes a Junit test that fails.
Just delete the file ‘ApplicationTest.java’
To compile, ‘clean and build’ on the parent HappyDog-parent.
To run, right click on HappyDog-app and select ‘Run’
If everything is set up right, then you should see this :
This is the basic frame for your application. All that is missing is modules you need to create, which we will look at in another tutorial.
We want out own splash screen instead of the default blue Netbeans spash screen that always pops up. To do this, we need an image, and we need to save it somewhere in the src/main/resources folder in the branding project :
Now If you right click the branding project you should see a ‘Branding’ option listed in the context menu. Select this menu item.
A number of branding related features are presented. Select ‘Splash Screen’. In this tab you can browse to the image you want for the splash screen, as well as customize other graphical features.
NEXT Part2. In the next tutorial we will be adding functional modules to the simple application we created in this tutorial.
All the code for this tutorial can be found on github.
Thanks to Luann Snawder Photography for the dog image https://www.flickr.com/photos/luann_snawder_photography/