Java Enterprise Architect, open source and Linux fan. Jacek has posted 11 posts at DZone. You can read more from them at their website. View Full User Profile

Swing JavaBuilder 1.1 : Declarative UIs With Maximum Productivity

  • submit to reddit
“Just started on using the Swing JavaBuilder and i must say i like it. Just replaced 170 rules of Java code with only 13 lines YAML”
Comment posted the JavaBuilders forum

Swing JavaBuilder 1.1 is out:

Please read our PDF book to get started.

Also, you can view our original JavaLobby article, although it refers to the older 0.3 version.

New in 1.1:
* switch to SnakeYaml for YAML parsing (which results in much more readable error messages)
* changed default file extension to .yml instead of .yaml
* misc bug fixes


Montreal, Canada
SwingJavaBuilder-1.1.pdf389.46 KB
Average: 5 (1 vote)
Published at DZone with permission of its author, Jacek Furmankiewicz.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Fred Swartz replied on Wed, 2010/12/22 - 11:41am

SwingJavaBuilder (SJB) is fantastic. With its compact YAML declaration of the GUI and a few conventions, it's about as easy as I can imagine to build a nice interface. I've done a fair number of Java GUI interfaces "by-hand" and am sick of writing the extensive, and sometimes complex, boilerplate code. SJB provides easy component creation, listener definition, data binding, and especially nice layout (using MigLayout). Using the Netbeans Matisse GUI editor worked ok for simple interface designs, but brought me no joy when they got complex -- simple editing mistakes made such a mess of things that starting over was easiest. And forget portability. Do not use it.

Undergraduate Java programming students often hit the GUI wall, where the difficulty of developing an interface discourages them enormously. It's sadly too late to move students to declarative interfaces, but something like SwingJavaBuilder would have allowed them to move into GUIs with relative ease.

I've tried other declarative GUI packages before, but thought SwingJavaBuilder to be better. One that I'd consider more if I had the time is Apache Pivot but the XML looked annoyingly verbose compared to the compact YAML notation at first glance.

Jacek Furmankiewicz deserves some kind of award for this work and his rapid response to any questions.

Cons: You have to learn the compact YAML notation (easy) and how to use MigLayout (far easier than the Java layout mess). Errors are caught at runtime instead of compile time, and the diagnostic messages are not always as quite as helpful as one would wish.

It's hard to imagine that someone wouldn't prefer this after using on just one project.

Jacek Furmankiewicz replied on Wed, 2010/12/22 - 1:38pm in response to: Fred Swartz

Thanks Fred, glad it has been helpful.

Greg Matoga replied on Thu, 2010/12/23 - 2:10am

This project seems to fit my needs perfectly. Before I decide to build an app on top of it I'd like to ask if anybody had experience with Rails backend integration? I'd like to make an intranet desktop client for app written on JRuby & RoR. Does Swing JavaBuilder consume Restful resources?

Jacek Furmankiewicz replied on Thu, 2010/12/23 - 7:01am in response to: Greg Matoga

Swing JB just builds your GUI and wires your listeners to Java methods. What you do in them is 100% up to you.

So, no it does not have any built-in REST support, but that's not its not goal. It's not a web framework nor a rich client platform. It's a library meant to dramatically reduce the LOC (lines of code) required to construct a GUI. That's where it ends.

In a Ruby on Rails context, think of it as Swing's equivalent of Haml :-)

Jacek Kruszelnicki replied on Thu, 2010/12/23 - 1:20pm

Any updates on the Vaadin version of Java Builder? :-)

Jacek Furmankiewicz replied on Thu, 2010/12/23 - 1:33pm in response to: Jacek Kruszelnicki

I have postponed it indefinitely.

With Oracle's disappointing leadership of Java (in particular its hostile attitude towards open source and the Google lawsuit), I am reducing my involvement in new open source Java projects. I am however 100% committed to the continued development and maintenance of Swing JavaBuilder.. I just started working on the new dev 1.2 branch, which will focus on more advanced GlazedLists integration.

Kondwani Mkandawire replied on Wed, 2011/02/23 - 5:58am

Call me simple minded but I fail to see the benefit of learning a new Syntax in Yaml combined with Java to create a Java App.  So now the developer has to have 2 mind sets?  The reason Wicket is so popular (and awesome) is that it eliminates the amount of stuff you have to know.  i.e. no Java Script, no Struts config files - hence you eliminate the XML mind set - after setting up web.xml you are in pure Java Mode (HTML is in a separate thought domain).

If what we are achieving after wacking together the extra Yaml files is databinding wouldn't it be easier to learn Spring Rich Client?  Or write your own databinder via reflection?

Sorry this might appear extremely simple to those who are in a position to appreciate Yaml - maybe I should do a little research on it - but I'm just trying to understand the mind set here.

Jacek Furmankiewicz replied on Tue, 2011/03/15 - 8:00pm in response to: Kondwani Mkandawire

The databinding part is 5% of the functionality.
The other 95% is are terse creation of objects, complex layout management via a DSL on top of MigLayout, built-in validators, support for running background tasks via SwingWorker, GlazedLists integration for table-based panels, etc.
One of our early adopters rewrote their whole banking platform from .Net Windows Forms to Swing JavaBuilder. They saw the long term value of increased productivity and *easy* maintenance.

Bikes Direct replied on Thu, 2011/08/11 - 12:26pm

It uses declarative UIs (in a YAML/Python-style format), controls layout via a MigLayout DSL, offers databinding via BetterBeansBinding, automatically wires listeners to methods, features build-in input validation and much more. In short, it's designed to make IDE-specific builders like NetBeans Matisse obsolete. -BikesDirect

Jennifer Frugalidad replied on Fri, 2011/08/19 - 11:00pm

This is great,.Thanks for posting!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.