Almost all Physlets support one or more add methods
designed to create an object and add it to the applet.
The addObject method with the following signature
addObject(String name, String attributes)
These objects usually, but not always, have an on-screen
representation. The first argument is the name of the object to be added,
and the second is a comma-delimited list of parameters.
A lens can be added using the following JavaScript statement:
document.physletname.addObject("box", "x=1,y=2,w=50,h=20");.
The
addObject method is very forgiving since not all parameters need to be
specified. Default values are
overridden only if the parameter appears in the list. Incorrect and unsupported parameters do not affect the applet
and are ignored.
|
Name |
Attributes |
|
arrow |
x- double x position
of the center in world units |
|
box |
x- double x position
of the center in world units |
|
caption |
x- double x position
of the center in world units |
|
circle |
x- double x position
of the center in world units |
|
cursor |
x- double x position
of the center in world units |
|
function |
f- String the
function. Usually f(x) or f(x,t). A function will use the
graph's current xmin and xmax values if the following are not specified. Functions can be explicit
functions of time. The function will animate if the clock is
running. |
|
image |
x- double x position
of the center in world units DataGraph will search for
images in the directory containing the jar files and in the directory
containing the html file. Both directories work from a server, but
the html directory search will fail in IE if the html file is located on
local hard drive. |
|
rectangle |
x- double x position
of the center in world units |
|
shell |
x- double x position
of the center in world units |
|
tangent |
x- double x position
of the center in world units |
|
text |
x- double x position
of the center in world units |