Creating a simple RCP app with Netbeans and Maven

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 :

rcp_1_1

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.

rcp_1_2

In the last screen leave everything as it is :

rcp_1_3

Select ‘Finish’.
Netbeans should have created three new projects. They all should have the same name, but are appended differently with –app, -branding and –parent.

rcp_1_4

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.

rcp_1_5

This is also reflected in the directory structure :

rcp_1_6

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.

rcp_1_7

Just delete the file ‘ApplicationTest.java’

Run Project

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 :

rcp_1_8

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.

Splash Screen

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 :

rcp_1_9

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.

rcp_1_10

 
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/

 

 


Posted in Netbeans RCP, Netbeans Tutorial, Tutorial | Tagged , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

THREE_COLUMN_PAGE