How to create a java GUI quickly?

I had to create a simple Java GUI for my diploma thesis. So I asserted, how I can do this. After quite some research, I found a solution which reduces the amount of code needed using some of the best technologies in combination:

1. GUI Tool

In order to create the GUI, WindowBuilder Pro should be used. It was a commercial software from Instantiations. However, Instantiations was bought by Google and all their tools have been released under an OpenSource License and are now available for free.

2. Layout

Currently, the best layout manager for a Swing GUI is MigLayout. It is announced to be inside JDK7. This layout works seamlessly in the WindowBuilder Pro.

3. Controller and Models

For the implementation of the Controller and the models, I suggest Groovy. This reduces the amount of Code needed for this kind of work.

4. Binding

Then, the model elements have to be associated to GUI elements back and forth. For this purpose, WindowBuilder Pro uses the BeansBinding JSR. This is not worked on anymore, but does work alright. In combination with Groovy, it is really very very easy to do. Just use the editor for setting up the bindings and annotate the Groovy Class with @Bindable. For Lists use the ObservableList from the BeansBinding Jar.

Summary

Using Groovy (with @Bindable) and WindowBuilder Pro, I have built an amazing Swing GUI in no time. With really, really small amount of code. You should try it out, too!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s