Working with Netbeans 4.2 Dev - Part 1

This past week has been an avalanche of new open source announcements. In particular there's been the final release of Eclipse 3.1, a preview of Matisse with the Netbeans 4.2 developer release, and the release of Trolltech's QT 4 for Windows, X11, and Mac OS X under their open source license. In this post I'm going to talk about Netbeans 4.2 and the many new features, large and small.

I downloaded and installed the development version of Netbeans. Given time this will become Netbeans 4.2. This release comes with three new major features that I am aware of; code completion extensions, support for Netbeans module creation, and Matisse, the GUI builder. I'll talk about the GUI builder in this post.

I downloaded the June 28th developer build from the developer build section of the Netbeans website. I downloaded the installer executable for Windows and then ran it. I then edited the file etc/netbeans.conf per the instructions on the Matisse page to enable the GUI construction tool extensions. After that it was a simple matter to fire it up.

I use Eclipse for a lot of Java development, and I've gotten into the habit of right clicking on the Package Explorer pane to create a new project. For Netbeans 4.1 and earlier this does not work. But for Netbeans 4.2 development, it does. Figure 1 shows the Project pop-up for Netbeans 4.2 dev. Figure 2 shows the Package Explorer pop-up for Eclipse 3.1.

Figure 1

Figure 2

Clicking on "New Project produced a project selection dialog (Figure 3) and another surprise. You can now explicitly create two types of Netbean module projects. In fact, it turns out there are now new tutorials for building plugins on the Netbeans site.

Figure 3

Once I had the project created I added a JFrame form to the project (Figure 4). From there I started to add various controls from the Palette.

Figure 4

One of the controls I attempted to add to the JFrame was a vertical slider (see Figure 5). The sliders on the Palette default to horizontal. So I placed the slider on the form and then attempted to change its orientation via the sliders properties panel. That produced an immediate exception. I noticed while working with the slider that every time I touched it I got an exception, until the Netbeans IDE would no longer work stably. I then had to shut down the IDE and start it back up.

Figure 5

The last figure, Figure 6, shows the layout with its indicators. (And yes, I know this is super ugly, but that's not the point). I am very interested to know what the various icons on the layout form mean. The lines are clear enough. They help to line up all the various controls, and they dynamically change as the controls are moved around the form. The semi-circles seem to indicate an anchor point.

Figure 6


The layout of Swing controls is clean and fairly intuitive. The alignment lines appear when they're needed, such as when elements line up (along top edges, side edges, or the centers of controls). I've yet to attempt to attach actions to the controls. The code generated by the layout tool is clean and understandable. An attempt to create a radio button group failed for me, but that could be my lack of understanding of how to use the tool properly. Hitting the form preview button on the editor generates a nearly instantanious frame with the controls. On Windows the preview is excellent. Over time the IDE seemed to stutter when adding controls or moving them around, but this may have been due to the exception generated by the slider exercise. Double clicking on any control allowed me to easily change the associated label text. Right clicking on any control brought up its property dialog and allowed me to inspect and change properties. Good.

While the alignment lines are good, I have to wonder what is wrong with the Visual Basic-style of control layout using a grid on the form. Symantec used this with Visual Cafe (Version 3) six years ago back when it was in the Java tools business. Other form creation tools, such as Trolltech's Designer, still use that method with great success. Surely snapping to points on a grid would be easier than what Netbeans Matisse is attempting? What's wrong with Netbeans (or Eclipse, for that matter) using the same style of layout?


  1. Hi Bill, thanks for giving Matisse a try -- and providing very useful feedback.

    Regarding exceptions, the current version is just a prevew so sometimes things do go wrong... The 'good news' :) is that most of the time it is enough to close and reopen the form, without having to restart the IDE.

    To your question on showing the grid on the form, there is simply no need for that in Matisse. Generated layout is not based on a grid concept nor on absolute XY coordinates (it uses parallel / sequantial groups of components instead), and the guidelines seem to be good enough to visualize the constraints between components -- or so we thought... :)



Post a Comment

All comments are checked. Comment SPAM will be blocked and deleted.

Popular Posts