GraphicsBuilder can do Swing now!
Posted by: Andres Almiray on October 21, 2007
The trick to arrange components is that GraphicsPanel has a null layout, so each component must define its bounds [x,y,width,height], both width and height will come from the components preferred size so only [x,y] should be specified, but if you recall the Swing/AWT API x and y are read-only properties, how can we solve this problem? thanks to Danno's efforts on SwingBuilder/FactoryBuilderSupport its now possible to register a closure (as many as you like as a matter of fact) to handle a node's attributes before the factories get first pick, the other piece of the puzzle is settings the bounds when the node has finished being built, and yes, it will also use a closure (as the attribute delegates) to handle postNodeCompletion (there are other improvements on FactoryBuilderSupport that warrant a post of their own).
But the goodies don't stop here, swingView will use a "standard" SwingBuilder by default, but you may pass a reference to any SwingBuilder subclass as well, for example SwingXBuilder or JideBuilder, enabling more nodes and more components with a single change as
The code should be up in a couple of days, once the demo app has been updated and retested.
Keep on Groovying!

About Andres Almiray
Andres is a Java/Groovy developer and a Java Champion with more than 20 years of experience in software design and development. He has been involved in web and desktop application development since the early days of Java. Andres is a true believer in open source and has participated on popular projects like Groovy, Griffon, and DbUnit, as well as starting his own projects (Json-lib, EZMorph, GraphicsBuilder, JideBuilder). Founding member of the Griffon framework and Hackergarten community event. https://ch.linkedin.com/in/aalmiray
Why Attend the NFJS Tour?
- » Cutting-Edge Technologies
- » Agile Practices
- » Peer Exchange
Current Topics:
- Languages on the JVM: Scala, Groovy, Clojure
- Enterprise Java
- Core Java, Java 8
- Agility
- Testing: Geb, Spock, Easyb
- REST
- NoSQL: MongoDB, Cassandra
- Hadoop
- Spring 4
- Cloud
- Automation Tools: Gradle, Git, Jenkins, Sonar
- HTML5, CSS3, AngularJS, jQuery, Usability
- Mobile Apps - iPhone and Android
- More...