James Williams
LinkedInMastodonGithub

Five tips to tame Matisse layouts

Tags: Java

I recently had to dust off some SwingXBuilder work for an interview and it got me thinking about the evil that is Matisse. Ok, it's not that evil, it's just that I couldn't use it and one tends to consider things he can't have are evil. And the more I had to do without it, I realized it was less of a necessity than I thought.

  1. Ditch Matisse. Seriously. Matisse generates a lot of code that isn't very readable. I don't like letting the computer think it's smarter than me, anyways. Even if you are the only UI guy, why be selfish and make everyone use Netbeans for the benefit of your bloody pointing-and-clicking?

  2. Break out the paper and pen/cil. Designing your user interface before coding will (most likely) make it more cohesive and better designed. All of the Web2.0 properties you know were designed on paper first, that RIA goodness didn't come with instantly sitting down with a WYSIWYG.

  3. Learn MigLayout. There's a reason Mikael Grev's session on MigLayout made him a 2008 JavaOne Rockstar. MigLayout gives all the flexibility and power of all the core layouts without cumbersome, unreadable constraints like ZoneLayout. It's part of the reason my version of jFlubber was about 50% smaller than the Java Matisse version.

  4. Use Swing(X)Builder for your layout even if the application is Java-centric. Seriously, like you expected me to say otherwise.

  5. Separate UI and action code. Doing so, especially in the Groovy context, will make your code more MVC and DRY-like.