WCM
Package net.sourceforge.webcompmath.applets
This page provides an overview of the classes in the package net.sourceforge.webcompmath.applets, which is part of the WCM project. The full API can be found in the JavaDoc documentation.
An applet is placed on a Web page using an "applet tag" in the html source code for the page. An applet tag can include "params" to customize the applet. Each param has a name and a value. When the applet runs, it can retrieve the value associated to a given param name, and configure itself accordingly.
A set of thirteen configurable webcompmath applets is available. All the applets except "Evaluator" and "ScatterPlotApplet" share a large number of params, which are described in the file Generic-params.html. Information on using these applets can be found in the here. Most of the applets subclass GenericGraphApplet, which is described in more detail below for those who want to create their own configurable applet.
class GenericGraphApplet
GenericGraphApplet is the base class for most of the configurable applets. It is used when your applet will have a DisplayCanvas to be used for graphing, an (optional) LimitControlPanel for managing the DisplayCanvas, and some fields and/or buttons (e.g., ExpressionInput) at the bottom. GenericGraphApplet reads and processes many different applet params, (see generic parameters for more details). This applet normally creates the applet on the web page, but if the specified height is less than 100, it will instead create a labeled button on the web page which, when clicked by the user, opens the applet in a separate window.
GenericGraphApplet provides the code to create an example menu at the top of the applet. But, since it cannot know how to actually set up your specific applet for a given example, you will need to override the doLoadExample() method to handle the actually setting of parameters in your example for each example. GenericGraphApplet does get the example text strings from the applet params in the html code for the applet and also builds the actual menu in the applet.
GenericGraphApplet uses several methods for actually getting and validating applet params and you can use these in your applet to create additional params. See the Javadoc for getParameter, getNumericParam, and getColorParam.class SimpleGraphApplet
SimpleGraphApplet is a good example to look at when trying to understand how to build your own configurable applet. It subclasses GenericGraphApplet, and hence inherits the applet params of GenericGraphApplet. SimpleGraphApplet achieves much of its customization by overriding the set up methods in GenericGraphApplet and extending them. For example, SimpleGraphApplet overrides setUpCanvas() from GenericGraphApplet. The first thing that the new method does is to invoke super.setUpCanvas() so that it can benefit from the work that GenericGraphApplet does. The new method then does whatever customization is needed, such as adding a graph to the DisplayCanvas and adding other (optional) points and lines. Similarly, setUpMainPanel() is overriden. First, the new method calls super.setUpMainPanel() and then customizes this by adding additional subpanels with more fields and buttons. Lastly, SimpleGraphApplet overrides doLoadExample() to handle its specific processing for examples that are specified in applet params.