Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

GroovySWT is

Excerpt

a wrapper around SWT, the eclipse Standard Widget Toolkit

. It allows you to easily write Eclipse SWT applications by using Groovy's builder mechanism.
Here is some SWT code using native Groovy:

Code Block
import org.eclipse.swt.SWT
import org.eclipse.swt.widgets.*
import org.eclipse.swt.layout.RowLayout as Layout

def display = new Display()
def shell = new Shell(display)

shell.layout = new Layout(SWT.VERTICAL)

shell.text = 'Groovy / SWT Test'

def label = new Label(shell, SWT.NONE)
label.text = 'Simple demo of Groovy and SWT'
shell.defaultButton = new Button(shell, SWT.PUSH)
shell.defaultButton.text = '  Push Me  '

shell.pack()
shell.open()

while (!shell.disposed) {
    if (!shell.display.readAndDispatch()) shell.display.sleep()
}

...

For a short example of using the JFace builder for creating a standard application see the TextEditor sample.
You can find about 70 examples in the example directory in subversion or you can download them here.

...

Please note the 0.5 was completely re-written to use FactoryBuilderSupport (to be able to be included in griffon), so there may be a few inconsistencies with version 0.3, but if you find any then please let me know. You can see the changelog for a list of all the changes.

Another major new feature in version 0.5 is the binding framework (build on top of the jface databinding and following the same style as the swing builder). You can find a little documentation with examples here.

...