BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Does Groovy need a GUI Builder

Does Groovy need a GUI Builder

This item in japanese

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
Style

BT