Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: case adjustment

...

Code Block
swing.registerBeanFactory('magicButton', MagicButton.class)
swing.frame() {
    MagicButtonmagicButton("It's Magical!")
}


Register a Custom Factory (new in 1.1Beta2)

...

Code Block
// a bit of a goofy example, we forcefully make the button blue
swing.registerFactory('blueButton',
     [newInstance:{builder, name, value, attrs ->
        attrs.remove('color')
        builder.button(value, color:Color.BLUE)}
    ] as groovy.swing.factory.Factory)

swing.frame() {
    blueButton('I want to be red!', color:Color.RED)
}

...