Archive

Posts Tagged ‘SWT’

Things to know about SWT, and groovy builders …

December 18, 2012 Leave a comment

i’ve been trying to deconstruct what the groovy SwtBuilder is doing as it doesn’t work as i wish, especially where you want to create a composite widget in a builder and link into a bigger SWT app

I went back to basics – i joined the codehause xirces svn server and located the SwtBuilder module – takes bit of digging.  downloaded that into an eclipse project and feed it all the jars it needs to build  for in my case juno 4.2 – including the SWT jar –

this took some while but i got there – i’ll add list later

however SWT is not as simple as i thought and i ran quickly into my first road block and only just found fix.  if you dont pack() your widgets – then no explicit size has been set and it assumes 0 – ie not visible.  so you either have to use a layout or pack each widget when finished declaring it for it to show

i’ve added a first draft tutorial for those who may wish to comment – this is being actively updated based on explorations with the groovy-swt builder

Wills Groovy SWT tutorial  v0.1

 

 

thus, for some shell (no layout set) then the call to pack() must be there to have the button show in the window

</p><p><br />def button = new Button (shell, SWT.PUSH)<br />button.text = 'my button2'<br />button.pack() //doesnt show if size not set <br /><br /></p><p>
Advertisements
Categories: Groovy, SWT Tags:
%d bloggers like this: