Skip to main content

Project Matisse: An update

Posted by gsporar on July 27, 2005 at 2:43 PM PDT

At the July meeting of the Austin Java User's Group (AJUG) I did a short demo of Project Matisse. The goal was to build a simple Find dialog box:


There were about fifty people in the auditorium. When I asked how many had done Swing development almost half the audience raised their hand. I started out by describing the problem that Project Matisse helps to solve: creating rich client user interfaces with Java is too hard. In particular, doing all the layout work is tedious and error prone. The main purpose of Project Matisse is to simplify the task of doing layout. And most seemed to agree that Project Matisse provides value here. When I grab a control and want to position it on the dialog I get guidelines that show me where to put it:


As I built the dialog I just typed in the string literals because it is faster (I had signed up for a fifteen minute time slot). But you don't have to do it that way - you can use values from a .properties file, which I had done when I created a version of the dialog beforehand. So after building and displaying the demo dialog I showed the pre-built version, which looks the same. But since I had used a .properties file I was able to change the locale to demonstrate that the correct things happen at runtime when different strings are used:


Note: for anyone who speaks Spanish, these translations might be a bit rough - I mostly used Google to create them. Lo siento, mi español es no bien.

Naturally, there were questions. One of which I had to do a bit more research on; the highlights:

1. Which layout manager does this use?

A new one that is under development, called GroupLayout. The goal is to eventually get GroupLayout into the JDK, but we're not going to wait that long before adding this functionality to NetBeans. There is an open source project for GroupLayout. The project lead is Scott Violet; check out his blog entry for more details.

2. What does the generated code look like?

It's very readable. A snippet from my pre-built version is below:


3. Is this available now?
Yes. But there are some caveats. Project Matisse is still incomplete and rough around the edges - the production release is not until later this year. For now it is development level stuff, not even a beta. As a result, it changes with each development build, as Bill Beebe recently described.

I breathed a sigh of relief during the demo when I was able to add the "Direction" title to the JPanel. When I was rehearsing the demo that didn't always work, leading me to file this bug. Also, if you look closely you'll see that the layout is not exactly correct. The "Match whole word only" checkbox should be aligned with the baseline of the text on the "Cancel" button. But doing it that way caused a problem with resizing the dialog, leading me to file this bug. But don't let these things dissuade you from trying it out - download a development build of NetBeans and provide feedback in order to help us make this the best visual editor for Java.

4. How do I enable it?
By default the functionality is turned off. To enable it you need to specify -J-Dnetbeans.form.new_layout=true when you start NetBeans.

5. Is there a DTD or schema for the .form file?
No. The NetBeans form editor has always stored metadata in a .form file. The format is XML but there is no DTD specified. For more info. take a look at the form editor project page.

6. Is Swing going away?
No. Swing is here to stay.

The rest of the AJUG meeting was very informative and the socializing afterward at NXNW was fun. John Reynolds has written an excellent summary.