Go backward to 2.3 Asserting Conditions
Go up to 2 Using the Toolkit
Go forward to 2.5 Writing Applets
Assuming that all of the code presented in the previous section is contained in a file Main.java, that the DAJ toolkit is appropriately installed, and of course that Java is running on your system, you can compile the program by executing
The program may be then called in stand-alone mode by calling
By creating a HTML file Main.html and inserting the code
you can embed the application as an applet in a Web page. Calling e.g.<APPLET code="Main.class" width=120 height=30 alt = "Your browser does not support Java."> <param name=buttonLabel value="Press me"> Please enable Java! </APPLET>
allows you to test the applet.