Welcome Elias.
Not a bad start for such a short time investigating!

FYI there are 3 official Hello Worlds here if you want to compare
(Pure Java, BXML & Scripting)
http://pivot.apache.org/tutorials/hello-world.html
http://pivot.apache.org/tutorials/hello-bxml.html

And quite a lot of example code in the SVN repository
http://svn.apache.org/repos/asf/pivot/trunk/demos
http://svn.apache.org/repos/asf/pivot/trunk/examples
http://svn.apache.org/repos/asf/pivot/trunk/tests
http://svn.apache.org/repos/asf/pivot/trunk/tutorials
http://svn.apache.org/repos/asf/pivot/trunk/tutorials-server

All of the above is bundled in the source code distribution available from
the download page
http://pivot.apache.org/download.cgi#2.0


Pivot uses interfaces to define its events via 'listeners' (such as the
WindowStateListener you use in your app).  Most of these interfaces contain
a static inner class named Adapter which is a minimal implementation of the
interface's methods. These are intended to be extended so that you only have
to implement the methods you are interested in. They are especially useful
when creating anonymous listener classes.
http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/WindowStateListener.java

So for your app, the code could be reduced to
window.getWindowStateListeners().add(new WindowStateListener.Adapter() {
@Override
public void windowClosed(Window arg0, Display arg1, Window arg2) {
System.exit(0);
}
});


Chris

On 21 June 2011 08:43, Elias Puurunen <[email protected]> wrote:

> Tonight I wrote an introduction to Pivot blog post... this was after an
> hour or so of hacking, so it might not even be good code, but hey.
>
> http://silverfinn.net/blog/?p=192
>
>

Reply via email to