This was the final demo in the BOF I did with Petr Pisl on Thursday at 21.30. It illustrates the power of using a framework to create rich-client applications. In fact, you're not creating
them, but assembling
them. Here's how it goes:
- In the New Project wizard, choose NetBeans Plug-in Modules under Categories and then choose Module Suite Project under Projects. Click Next and name the project Text Editor. Click Finish.
- Right-click the Text Editor project node and choose Properties. In the Application category, select "Create Standalone Application". In the "Exclude IDE Modules" dialog box, choose Exclude. In Application Title, type "Text Editor". Click OK.
- Right-click the Text Editor project node and choose Run. The NetBeans Platform splash screen is shown. When it is deployed, the application looks as follows:
- Back in the IDE, right-click the Text Editor project node again, choose Properties, and then choose the Libraries category. Expand the platform6 node. Put a check mark in the "Favorites" item (i.e., select that item). Click OK.
- Right-click the Text Editor project node and choose Run. (I had to fiddle a bit here, also during the demonstration. Maybe because I eventually chose "Clean and Build All", it worked. I don't know. Before the fiddling, the Favorites item in the next step didn't appear. Maybe because I'm using a dev build.)
- Once the application is redeployed, go to the application's Window menu and choose Favorites. The Favorites window appears. Now right-click inside the Favorites window and open a file. And then open another one. Now you see this:
You can now make use of the NetBeans Platform's windowing system by dragging the Favorites window to a different position (hold down the tab with your mouse and then drag it):
To distribute the application, right-click the Text Editor project node again and choose "Build ZIP Distribution". A ZIP file will be built. It will include an executable for launching the application. You can also choose "Build JNLP Application", which will build the files needed for launching the application as a webstartable application.
The Favorites window is one of many modules that the IDE provides and which you can make use of. This is the simplest (useful) rich-client application that you can build on the NetBeans Platform. Others are outlined at http://platform.netbeans.org/tutorials. For example, there you can find out how to create an HTML Editor (which requires only slightly more work than this Text Editor) and a Feed Reader.