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

Taking JavaFX Head-on: Java SwingBuilder 0.1.RC2 [UPDATED]

06.26.2008
| 4249 views |
  • submit to reddit

Java SwingBuilder is an attempt to bring dynamic language-type productivity to Java Swing UI development by defining the layout/event wiring/binding in a separate YAML file and leaving the Java class to focus on pure business-side code. Inspired by Groovy SwingBuilder (the concept in general), Ruby on Rails (YAML is the new JSON/XML, but leaner) and GTK+ libGlade (for the idea of keeping layout and event wiring in a separate file). It also pinches a few ideas from Apache Wicket (e.g. keeping the Java and source YAML file in the same package with the same name as a hard-coded convention).

Summary: 0.1 Release Candidate 2 for the Java SwingBuilder project, an alternative approach to declarative UIs in pure Java.

We borrow ideas from the best and throw in a few of our own, such as our DSL for visual layout management, which basically provides you a GUI builder...in pure text (it's like Matisse for Notepad). I think it's the crown jewel of the Java SwingBuilder, nothing like it exists in any other tool (including the Groovy SwingBuilder or the new JRuby Glimmer).

We also provide a simple way to hook up events directly to Java methods without the need to code any listener or wait for closures to arrive. A simple Java annotation is all that is needed to flag a method to be executed in the background using SwingWorker. There is also some initial work done on integrating data input validation using Apache Commons Validators routines.

 Uses MigLayout as the main layout manager (supports CardLayout and FlowLayout as well). MigLayout makes all other JDK layout managers obsolete, hence none of them are supported. Data binding is supported via the standard Beans Binding library and support for long running tasks is integrated via SwingWorker.

End goal of the project: to define max functionality with the least amount of code and make JavaFX obsolete before it even arrives. The original idea for the project came out of frustration with Sun's strategy of forcing a whole new language (JavaFX Script) instead of enhancing pure good old Java.

Sample UI, YAML build file and the Java file that loads it:

http://picasaweb.google.com/jacek99/Misc/photo#5215751012067940994

http://javabuilders.googlecode.com/svn/trunk/org.javabuilders.swing/samples/org/javabuilders/swing/samples/ComponentsPanel.yaml

http://javabuilders.googlecode.com/svn/trunk/org.javabuilders.swing/samples/org/javabuilders/swing/samples/ComponentsPanel.java

 Please visit the main project site and read up on the Wiki:

http://javabuilders.org

or post questions in our Google Group:

http://groups.google.com/group/javabuilders?hl=en

 

Location: 
http://javabuilders.org
AttachmentSize
Screenshot-Java.png78.07 KB
0
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.)

Comments

Jacek Furmankiewicz replied on Mon, 2008/06/30 - 4:58am

0.1.RC2 is out now. Contains fixes to input validation and event handling, as well as a brand new feature: Custom Global Commands:

http://code.google.com/p/javabuilders/wiki/CustomCommands

 

 

 

Comment viewing options

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