Five tips to tame Matisse layouts
Posted
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.
Comments
-
Romain Guy
said:
I understand and agree with most of your points... However Matisse has one huge advantage: you don't have to learn any new library and/or language.
-
James W
said:
True, one can do great things with Matisse but one of the problems I see is a lack of a proper design phase. The Groovangelist in me would love to see everyone use Groovy but as Jacek's JavaBuilder shows, that's not exactly a possibly for all.
-
Jean-Francois Poilpret
said:
There are also very good LayoutManagers out there with a _very_ simple API (more or less a DSL), with no need for a visual designer. DesignGridLayout is one good example.
-
Steve W
said:
Why anyone in this day and age wants to worry about layout engines is beyond me. I've been developing using swing professionally for years now and if you need to create dozens of screens in next to no time then drag&drop is the way to go, no contest.
Now I can understand how someone using Swingit for hobbies my think different but in the commercial world the days of playing around with layout settings has long gone, there isn't time. Drag it drop it, test it, perfect.
Does the use worry if the code is a few lines longer NO.
Is Mattise code difficult to fix in Eclipse (yuck), no, not if you know what your doing.
Why plan the design on paper ! I do it on the screen where I want it to be, plus I can immediately check it and show it to customers quickly as a prototype. I've even designed screens with users within Netbeans, they like it, it really works for them. Infact I left one screen with them to play around with until they were happy.
Anyway my 2p.
Steve
blog comments powered by Disqus