CAPDM Tutorial Applets

Porfolios - Various Stocks

Functionality:

This Portfolio Applet shows various random stocks taken from a dataset showing price of those stocks. The main point is to see how increasing number of stocks in the portfolio tends to reduce risk.

Remote Control using JavaScript

Information about the applet can be shown. See the 'Runtime Applet API Calls' section below for details.

Examples

Show 'About' dialog

How to Invoke the Applet

The applet can be invoked by embedding an APPLET tag into your HTML document (if you look at the source of this document you will see a working example you can copy). The table below details the basic parameters used and additional startup parameters that are specific to this applet.

<APPLET 
  CODEBASE="../../../../classes"
  ALT="Portfolios"
  CODE="applet.capdm.finance.portfolios.PortfoliosApp" 
  NAME="Portfolios"
  WIDTH="425"
  HEIGHT="450">
  <PARAM NAME="DataFile" VALUE="StockData.dat">
<PARAM NAME="ShowGraph" VALUE="7">
<PARAM NAME="LineDrawSpeed" VALUE="6">
<PARAM NAME="GraphFlipSpeed" VALUE="20"> </APPLET>
Basic Parameters Use
CODEBASE="../../../../classes" The CODEBASE of the applet must point at the top-level classes directory in order for the applet to be found.
CODE="applet.capdm.finance.
portfolios.PortfoliosApp"
This required attribute gives the name of the file that contains the applet's compiled Applet subclass. This file is relative to the base URI of the applet.
ALT="Portfolios" This optional attribute specifies any text that should be displayed if the browser understands the APPLET tag but can't run Java applets.
NAME="Portfolios" This optional attribute specifies a name for the applet instance, which makes it possible for applets on the same page to find (and communicate with) each other. If you intend to use JavaScript/Applet scripting then the applet must be named a shown.
WIDTH="425" HEIGHT="450" These required attributes give the initial width and height (in pixels) of the applet display area, not counting any windows or dialogs that the applet brings up.
Applet Startup Parameters Use
<PARAM NAME="DataFile" VALUE="StockData.dat"> Points to the data file used by the applet to generate graphs.
<PARAM NAME="ShowGraph" VALUE="7"> The parameter used to select this specific version of the Portfolio Applet that shows the correct graphs.
<PARAM NAME="LineDrawSpeed" VALUE="6"> Parameter controls speed of drawing of an individual plotted line
<PARAM NAME="GraphFlipSpeed" VALUE="20">


Parameter controls time between drawing graphs

For more information on the use of the APPLET tag and other attributes you can use but which are not listed above, visit the W3.org specification page at: APPLET tag in HTML 4.

Runtime Applet API Calls

API Call Name Parameters Use and Result
showAbout none javascript:showAbout(); Shows the version dialog box of this applet.