I’ve been working on my little app to Sync Outlook to Remember The Milk and having a great time learning GroovySWT along the way. GroovySWT offers a SwtBuilder and JFaceBuilder (simple DSL) for putting together SWT/JFace applications. Now I’m a huge fan of both SWT and JFace, so I was very keen to see what GroovySWT could let me do from straight groovy code.

It’s very early days for the GUI, but I’ve thrown together some scratchy ideas using the Tango Icon Library to get a basic interface underway.

SyncTheMilk in action on OSX

I still think the ideal way to build GUIs is with a tool. Even with the sensational DSLs that SwingBuilder and SwtBuilder give you, nothing beats dragging and dropping stuff around (personal fave is SWT Designer, which is unbelievably good - FD: I managed to get a free copy from the early days).

But if your GUI is very simple (like the one shown above), it really does seems a shame not to be able to throw something together really quickly using straight groovy, and GroovySWT gives you that in spades. How about a little Preferences dialog for your app which automatically persists user entries to a .properties file?

An SWT Preferences dialog

preferenceDialog() {

    preferencePage( title:"Proxy Settings", filename:"syncthemilk.properties" ) {
        booleanFieldEditor( propertyName:"proxyEnabled", title:"Enable Proxy" )
        stringFieldEditor( propertyName:"proxyHost", title:"Proxy Host" )
        integerFieldEditor( propertyName:"proxyPort", title:"Proxy Port" )
    } 		

    preferencePage( title:"RTM Settings", filename:"syncthemilk.properties" ) {
        stringFieldEditor( propertyName:"rtmToken", title:"RTM Token" )
    }
}

I’ve found a few little bugs in the current groovy-swt source which I’ll bundle up in a patch and submit once I have the full GUI for my app done. That should let me exercise a good part of the library.

The only major shortcoming I’ve found so far is there is virtually no documentation. There are, however, a ton of good examples that demonstrate many of the cool and interesting parts of the library (including tray integration, properties dialogs, wizards, and more).

I’ll update the Groovy wiki with some new info once I’ve had a chance to get my own GUI done.

Huge props to Christiaan ten Klooster for all the fantastic work he has put into GroovySWT. Really a first class effort.