GraphicsBuilder: property aliases - No Fluff Just Stuff

GraphicsBuilder: property aliases

Posted by: Andres Almiray on February 16, 2008

Following one of James latest posts on Java3DBuilder I decided to align GraphicsBuilder.color with Java3DBuilder.color, meaning that it now accepts [r,g,b,a] as properties besides [red,blue,green,alpha]. But the news don't stop there, other commonly used properties as width, height and radius (among others) have aliases too, once the next version is released the documentation will include the relevant aliases.

The default aliases will make your code shorter, the aliases mechanism will let you register any alias you may desire. Thanks to the facilities provided by FactoryBuilderSupport, GraphicsBuilder's shortcut version has improved a bit over SwingXBuilder's because it allows you to register shortcuts using the node's name and not the node's classname.

Here is a simple example of a rectangle with dimensions [width:100,height:100], a border of width 2 and color black, and a gradient with two stops. First the regular version, then the aliased version

Oh, and color() has also an alias: rgba().

Keep on Groovying!
Andres Almiray

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...
Learn More »