Does Groovy need a GUI Builder

| by Rob Thornton Follow 0 Followers on Mar 30, 2007. Estimated reading time: 1 minute |

Geertjan is integrating Groovy support into NetBeans 6.0 and is impressed with the ease of writing Swing code in Groovy. He questions whether a Matisse-like GUI builder is necessary for Groovy. Danno Ferrin responds that layout, specifically GroupLayout is the reason.

Geertjan begins by throwing up a very simple UI and suggesting some simple pseudocode that most people, regardless of programming skill and experience, would be able to come up with. He then shows that you can take his pseudocode and paste it into a Groovy context, add a few lines to load the SwingBuilder, and get the simple UI expected. He then states:

Given how easy this all is in Groovy, I wonder whether the Groovy community even needs a Matisse-like GUI Builder. It all seems pretty intuitive, and with syntax coloring and code completion, plus maybe one or two other fun things (such as the Navigator shown above), coding Swing in Groovy is going to be a breeze.

Mike A quickly commented that the example is very simple and doesn't discuss actions, events, data binding, etc. Danno Ferrin says that layout is the key piece missing from the example.

Geertjan's sample is deceptively simple. Why the widgets are nicely centered and separated is because the default layout of a Panel is FlowLayout. This is only really useful for simple GUI demonstrations and nested button panels anyway. What if you are doing an address form where the labels are all left aligned and the text fields all need to fill the same width (which is for most to the right edge of the form), except for the checkbox on row 4 for suite number.

His example is more complicated than shown here and he ends with the point that layout code is hard to write and that visual designers, such as Matisse, make the problem a lot easier to handle.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

People don't waste time building GUI by Felipe Cruz

Groovy need a GUI builder.

But in my opinion, the point is that today people don't want to waste time building GUI and not if the code is simple or not..

Re: People don't waste time building GUI by Andres Almiray

Felipe, you're right, not many will like to "waste time" coding UIs, but the truth is that there will be cases where generating a panel dynamically will be easier with something like Groovy's closures and builders.

PS: did you study at ITESM ?

Re: People don't waste time building GUI by Felipe Cruz

Agree with you.. groovy can help a lot when building dynamic GUI stuff

I did not study at ITESM.

Down with the GUI builders by Robert McIntosh

I have yet to see a GUI builder that built a decent looking UI. Anyone who uses such a tool probably doesn't care about how their UIs look. Besides, in most cases a good coder can hand build a good UI in roughly the same time as someone futzing with a builder tool.

Re: Down with the GUI builders by Felipe Cruz

NetBeans Matisse?

A good coder with a good UI builder can build much more faster than a good coder without...

Re: Down with the GUI builders by Stefan Kleine Stegemann

As a frequent user of Apple's Interface Builder I really can't believe why people are questioning the need for a GUI builder. Writing GUI code is just booooring. Good coders won't even think about wasting their time with writing GUI code unless they have to because of the lack of good tools. I really wonder why there isn't any GUI builder for Java that catches up with Interface Builder or even the old Delphi GUI builder.

What GUI Builders are? by Robert Thomas

We need more that drag & drop forms. We need higher abstraction: ui-pattern validation, use case validation, easy control integration, etc.

I'm really looking forward what these guys from Himalia are doing for Visual Studio right now. I think they will move to the Java platform when if pass the alpha version ;)
At least, their technology is platform independent...

Really, I think they are in the right direction, nowadays UI building is obsolote and doesn't scale.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

7 Discuss