Apache Pivot's Hello World Tutorial in Groovy
The following is a port of the JavaScript example on http://pivot.apache.org/tutorials/hello-wtkx.html to Groovy.
Note : I could not get
def windowOpened(window){
to work, so that is why I use a closure instead.
<Window title="Hello JavaScript!" maximized="true"
xmlns:wtkx="http://pivot.apache.org/wtkx"
xmlns="org.apache.pivot.wtk">
<windowStateListeners>
<wtkx:script language="groovy"><![CDATA[
import org.apache.pivot.wtk.*;
windowOpened = { window ->
def label = new Label();
label.setText("Hello Groovy!");
label.getStyles().put("font", "Arial BOLD 24");
label.getStyles().put("color", "#ff0000");
label.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
label.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
window.setContent(label);
}
]]></wtkx:script>
</windowStateListeners>
</Window>
Copyright © 2011, Aaron Blondeau
Drupal theme by Kiwi Themes.