![]() |
F O R · R E A L L Y · T H I N · C L I E N T S |
Home | Overview | Widgets | Demo | License | History | |
This overview is a step by step guide to create a simple calculator applet and application. See the API documentation, the detailed list of Thinlet's public methods. |
Layout and component properties Edit an xml file (called calculator.xml) which describes the hierarchy and the static attributes of the components. The root panel component contains 3 textfields, a label (+) and a button (=). For event handling identify the textfields with names, and add method name (action listener) for the button.
![]() Java source both for applet and application Create the Calculator class (Calculator.java) extending Thinlet. Running the calculator as application the main method creates a frame including the Calculator component and invokes its init method. The init method loads the panel (decribed in the xml file) and add to the desktop.
Event handling Complement the Calculator.java source with the business logic. The calculate method computes the sum of the first two fields' value, and updates the third field.
Compile, run, and deploy Add the thinlet/src directory or the lib/thinlet.jar to your classpath and compile the source using e.g the jikes Calculator.java command, and run it, java Calculator. For applet create a jar archive including Calculator.class, thinlet/*.class, calculator.xml (and later image) files (jar cvfM calculator.jar Calculator.class thinlet/*.class calculator.xml). Note, Netscape 4.x browser doesn't load unknown (e.g. *.xml) resources from jar archive, thus rename the files to calculator.txt and update the java sources. Use thinlet.AppletLauncher to load any thinlet component, you have to add the class parameter including the class name of your thinlet component.
|
Copyright © 2002 Robert Bajzat - info@thinlet.com - All rights reserved. |