Examples/Counter.jaxx |
From JAXXWiki
This is an implementation of Challenge #1 from the XUL Grand Coding Challenge 2004. Because this example program has been implemented in so many different languages, you can easily compare JAXX's syntax against the competition and decide for yourself which you prefer.
Note that the Counter Showcase Page includes only the XML markup for the examples; the scripts and other code that accompany them are not displayed and will have to be downloaded separately. JAXX is one of the very few languages that does not require any external support code, and so in this case the XML is all there is.
Screen shot
letovar
See it in action
To run this example in Java Web Start, click the following link:
To compile and run it yourself, first follow the instructions for installing JAXX. Then download and save the source code using the link below. Once you have done that, compile and run it as follows:
c:\jaxx\examples> jaxxc Counter.jaxx c:\jaxx\examples> java -classpath .;c:\jaxx\lib\jaxx-runtime.jar Counter
The first command above assumes that you are in the directory containing the Counter.jaxx file. Compiling it as shown will produce a class file named Counter.class in the current directory, and because you were in the same directory as the JAXX file the resulting class will not be placed in a package (its fully-qualified name is just Counter).
At this point Counter is a perfectly ordinary Java class, and the only special requirement to run it is that jaxx-runtime.jar be in the classpath.
Source code
Download the source code Counter.jaxx
<Application title="Counter">
<script>int count;</script>
<JTextField text='{count}' constraints='BorderLayout.NORTH'/>
<HBox constraints='BorderLayout.SOUTH'>
<JButton label='Dec (-)' onActionPerformed='count--'/>
<JButton label='Reset' onActionPerformed='count = 0'/>
<JButton label='Inc (+)' onActionPerformed='count++'/>
</HBox>
</Application>


