eField4
Class EField

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--edu.davidson.tools.SApplet
                                |
                                +--eField4.EField
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class EField
extends SApplet

EField is part of the Davidson College Physlets project. EField plots electric fields given a potential function and/or point charges. Both fixed charges and moving test charges can be specified using "add" methods.

The following embedding parameters are defined:

Parameter Value Data Type Description
FPS 10 double Frames per second during animation.
dt 0.1 double Animation time step per frame.
ShowControls true boolean Show VCR buttons at bottom of applet.
ShowContours true boolean Show equipotential contours.
ShowPoles true boolean Show fixed charges.
ShowLabels true boolean Add labels to contour lines.
ShowFieldLines false boolean Draw field lines. Computationally EXPENSIVE
ShowFieldVectors true boolean Draw direction arrows to represent field.
PointChargeMode true boolean Select between point charge and line charge mode.  Use 1/(r*r) dependence for fixed charge if true.  Use 1/r dependence if false.
PixPerUnit 10 double Conversion from pixel units to world units.
GridUnit 1.0 double The grid spacing.  A value of 0 will suppress the grid.
Potential 0 string The potential function, U(x,y).
Range -1,1,-1,1 string Approximate x and y coordinate range.  X range takes precedence to insure 1:1 aspect ratio. MUST be a string: "-1,1,-1,1"
GridSize 64   (Not Implemented.)

Various objects in EField implement the data source interface.  This interface, SDataSource, enables inter-applet data passing between Physlets.

Object Identifier Variables
Fixed Charges. The id is returned when an object is created using an add method.
id=addCharge(double x, double y, double m)
t, x, y, vx, vy, ax, ay, fx, fy, p, m, q
Note: p is the potential and q is the magnitude of the charge.
All shapes: circle, rectangle, box, etc. The id is returned when an object is created using an add method. t, x, y, vx, vy, ax, ay
clock id=getClockID() t

Methods to access the animation clock can be found in the superclass documentation, SApplet.

See Also:
Serialized Form

Fields inherited from class edu.davidson.tools.SApplet
clock, dataConnections, dataListeners, dataSources, lock
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
EField()
           
 
Method Summary
 int addObject(java.lang.String name, java.lang.String parList)
          Create an object and add it to the Physlet.
 void clearSeries(int s)
          Clear the data from a graph series.
 void deleteCharges()
          Deletes the fixed charges.
 void deleteDataConnection(int id)
          Break the data connection identified by the id.
 void deleteDataConnections()
          Break all data connections.
 void deleteObject(int id)
          Delete an object from the applet.
 void deleteSeries(int s)
          Delete a series from the graph
 void deleteTestCharges()
          Deletes the test charges.
 void destroy()
           
 void forward()
          Resume the simulation with a positive time step.
 java.lang.String getAppletInfo()
           
 int getGraphID()
          Get the series ID for the graph object.
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
           
 java.lang.String[][] getParameterInfo()
           
 int getSeriesID(int sid)
          Get the series ID, that is the hashcode, from a series number.
 double getTime()
          Get the y velocity of an object.
 double getVX(int id)
          Get the x velocity of an object.
 double getVY(int id)
          Get the y velocity of an object.
 double getX(int id)
          Get the x position of an object.
 double getY(int id)
          Get the y position of an object.
 void init()
           
 void jbInit()
           
 int makeDataConnection(int sourceID, int listenerID, int seriesID, java.lang.String xStr, java.lang.String yStr)
          Make a data connection between a data source, i.e.
 void pause()
          Pause the simulation
 void reset()
          Reset the initial conditions at time t=0.
 void reverse()
          Resume the simulation with a negative time step.
 boolean set(int id, java.lang.String name, java.lang.String parList)
          Change the properies of an object.
 boolean setAnimationSlave(int masterID, int slaveID)
          Force an object to follow another object on the screen.
 void setAutoRefresh(boolean ar)
          Repaint whenevers the system parameters are changed.
 void setBz(double bz)
          Set the z component of the magnetic field.
 void setCaption(java.lang.String c)
          Set the caption.
 void setChargeLabel(java.lang.String l)
          Set the charge label.
 boolean setChargeMagnitude(int id, double mag)
          Set the magnitude for a charge.
 void setChargeRGB(int r, int g, int b)
          Set the color for new charges.
 void setChargeTrail(int t)
          Set the animation the default trail length.
 boolean setConstrainR(int id, double r, double x, double y)
          Constrain the motion of the test charges to a circular path.
 boolean setConstraintStr(int id, java.lang.String str, double xmin, double xmax)
          Constrain the motion of the test charges to a path given my F(x).
 boolean setConstrainX(int id, double x, double xmin, double xmax)
          Constrain the motion of the test charges to a path of constant x.
 boolean setConstrainY(int id, double y, double ymin, double ymax)
          Constrain the motion of the test charges to a path of constant y.
 boolean setDamping(int id, double d)
          Set the color for an object.
 void setDampOnMousePressed(boolean damp)
          Set the velocity of an object to zero if it is being dragged.
 void setDefault()
          Sets the default conditions.
 boolean setDisplayOffset(int id, int xOff, int yOff)
          Offset the object's position on the screen from its default drawing position.
 void setDrag(boolean drag)
          Set drag for all subsequently created charges.
 boolean setDragable(int id, boolean drag)
          Make the object with the given id dragable.
 void setFieldResolution(int r)
          Set the field resolution determines how the spacing of the field vectors on the grid.
 boolean setFont(int id, java.lang.String family, int style, int size)
          change the object's font for any text that is displayed.
 boolean setFootPrints(int id, int n)
          Set the trail to leave footprints as the charge moves.
 boolean setFormat(int id, java.lang.String fstr)
          Change the object's format for the display of numeric data.
 boolean setGhost(int id, boolean ghost)
          Have the charge draw ghost images as it moves.
 void setGridSize(int n)
          Set the grid size for the evaluation of the potential energy.
 void setHideCharge(boolean hc)
          Hide all charges.
 boolean setLabel(int id, java.lang.String label)
          Make the object label.
 boolean setMass(int id, double m)
          Set the mass of an object.
 void setMaxTime(double max, java.lang.String msg)
          Stop the simulation at a predetermined time and display a message for the user.
 boolean setOnScreenSize(int id, int size)
          Set the size for an object.
 void setPointChargeMode(boolean pcm)
          Set point charge to produce 1/(r*r) field.
 void setPotential(java.lang.String ps, double xmin, double xmax, double ymin, double ymax)
          Set the potential function.
 boolean setRGB(int id, int r, int g, int b)
          Set the color for an object.
 void setSeriesRGB(int id, int r, int g, int b)
          Set the series line and marker color.
 void setSeriesStyle(int id, boolean conPts, int m)
          Set the series style for the graoh object.
 void setShowCharge(boolean sc)
          Display all fixed charges on the screen.
 void setShowConstraintPath(int id, boolean sc)
          Show a the constraint function that test particles must follow.
 void setShowContours(boolean sc)
          Show the contour lines.
 void setShowCoordOnDrag(boolean sc)
          Show the coordinates on a mouse drag.
 void setShowEOnDrag(boolean se)
          Show the field at the mouse postion on a mouse drag.
 void setShowEquipotentialOnClick(boolean sp)
          Draw equipotential starting at the mouse click.
 void setShowEquipotentialOnDoubleClick(boolean sp)
          Draw equipotential starting at the mouse double click.
 boolean setShowFComponents(int id, boolean sc)
          Enable the charge force vector to show components when it is drawn.
 void setShowFieldLineOnClick(boolean sfl)
          Draw a field line starting at the mouse click.
 void setShowFieldLineOnDoubleClick(boolean sfl)
          Draw a field line starting at the mouse double click.
 void setShowFieldLines(boolean sfl)
          Show the field lines.
 void setShowFieldVectors(boolean sfv)
          Show the direction field vectors.
 boolean setShowFOnDrag(int id, boolean sfm)
          Enable the charge to show the force magnitude in the message box.
 void setShowForce(boolean sf)
          Show the default to show the force vector on all subsequently created test charges.
 boolean setShowFVector(int id, boolean sf)
          Enable the charge to show the net force vector when it is drawn.
 void setShowLabels(boolean sl)
          Show the contour labels.
 void setShowTime(boolean st)
          Show the simulation time.
 boolean setShowVComponents(int id, boolean svc)
          Enable the charge velocity vector to show components when it is drawn.
 void setShowVelocity(boolean sv)
          Show the default to show the velocity vector on newly created test charges.
 void setShowVOnDrag(boolean sv)
          Show the potential at the mouse postion on a mouse drag.
 boolean setShowVVector(int id, boolean sv)
          Enable the charge to show the net velocity vector when it is drawn.
 int setSketchMode(boolean sketch)
          Enable sketching with the mouse.
 boolean setSpeed(int id, double speed)
          Change the speed of a test charge.
 boolean setSticky(int id, boolean isSticky)
          Make the object stickey so that collisions stop the animation.
 void setTimeContinuous()
          Let the simulation continue forever.
 void setTimeCycle(double max)
          Cycle the simulation
 void setTimeOneShot(double max, java.lang.String msg)
          Run the simulaiton one time.
 void setTimeVisibility(boolean visible)
          Enable the time display in the applet window.
 void setTolerance(double t)
          Set the tolerance for the animation calculations.
 boolean setTrail(int id, int pts)
          Set the trail behind a charge.
 boolean setTrajectory(int id, java.lang.String xStr, java.lang.String yStr)
          Set the trajectory of a pole.
 boolean setVisibility(int id, boolean show)
          Show the visibility of the object.
 void setXRange(double xmin, double xmax)
          Set the scale using the horizontal axis.
 boolean setXY(int id, double x, double y)
          Set position of an object.
 void setYRange(double ymin, double ymax)
           
 void start()
           
 void stepBack()
           
 void stepForward()
           
 void stepTimeBack()
          Step the simulation one negative time step.
 void stepTimeForward()
          Step the simulation one positive time step.
 void stop()
           
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, cleanupDataConnections, clearAllData, clearData, getClockID, getClockTime, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, removeDataListener, removeDataSource, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setDt, setExternalClock, setFPS, setRunningID, setRunningID, startClock, stepClock, stepTime, stopClock, updateDataConnection, updateDataConnections
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EField

public EField()
Method Detail

addObject

public int addObject(java.lang.String name,
                     java.lang.String parList)
Create an object and add it to the Physlet. The first argument is the name of the object to be added and the second is a comma-delimited list of parameters. For example, a circle can be added a follows:

addObject ("circle", "x = 0, y = -1.0, r = 10");

See the supplemental documentation for a list of object names and parameters.
Parameters:
name - the type of object to be created.
parList - a list of parameters to be set
Returns:
id that identifies the object.

clearSeries

public void clearSeries(int s)
Clear the data from a graph series. Series properties such as color and style remain unchanged.
Parameters:
Series - ID

deleteCharges

public void deleteCharges()
Deletes the fixed charges.

deleteDataConnection

public void deleteDataConnection(int id)
Break the data connection identified by the id.
Overrides:
deleteDataConnection in class SApplet
Parameters:
id - The data connection id.

deleteDataConnections

public void deleteDataConnections()
Break all data connections.
Overrides:
deleteDataConnections in class SApplet

deleteObject

public void deleteObject(int id)
Delete an object from the applet.
Parameters:
id - the object identifier
Returns:
true if successful

deleteSeries

public void deleteSeries(int s)
Delete a series from the graph
Parameters:
Series - ID

deleteTestCharges

public void deleteTestCharges()
Deletes the test charges.

destroy

public void destroy()
Overrides:
destroy in class SApplet

forward

public void forward()
Resume the simulation with a positive time step.
Overrides:
forward in class SApplet

getAppletInfo

public final java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet

getGraphID

public int getGraphID()
Get the series ID for the graph object. This ID is used to make a connection to a SDataSource.

getParameter

public java.lang.String getParameter(java.lang.String key,
                                     java.lang.String def)

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet

getSeriesID

public int getSeriesID(int sid)
Get the series ID, that is the hashcode, from a series number. Hash codes are unique object identifiers that are defind by the Java VM. Series numbers are 0,1,2,.......

getTime

public double getTime()
Get the y velocity of an object.
Parameters:
id - The id of the object.

getVX

public double getVX(int id)
Get the x velocity of an object.
Parameters:
id - The id of the object.

getVY

public double getVY(int id)
Get the y velocity of an object.
Parameters:
id - The id of the object.

getX

public double getX(int id)
Get the x position of an object.
Parameters:
id - The id of the object.

getY

public double getY(int id)
Get the y position of an object.
Parameters:
id - The id of the object.

init

public void init()
Overrides:
init in class java.applet.Applet

jbInit

public void jbInit()
            throws java.lang.Exception

makeDataConnection

public int makeDataConnection(int sourceID,
                              int listenerID,
                              int seriesID,
                              java.lang.String xStr,
                              java.lang.String yStr)
Make a data connection between a data source, i.e. a charge, and a data listener. Typical data listeners are graphs and spread sheets.
Overrides:
makeDataConnection in class SApplet
Parameters:
sourceID - The source ID.
listenerID - The listener ID.
seriesID - The listener ID series.
xStr - The ordinate to be passed to the data listener.
yStr - The abscissa to be passed to the data listener.
Returns:
An ID that identifies the data connection.

pause

public void pause()
Pause the simulation
Overrides:
pause in class SApplet

reset

public void reset()
Reset the initial conditions at time t=0.
Overrides:
reset in class SApplet

reverse

public void reverse()
Resume the simulation with a negative time step.
Overrides:
reverse in class SApplet

set

public boolean set(int id,
                   java.lang.String name,
                   java.lang.String parList)
Change the properies of an object. The first argument is the object identifier. The second argument is the name of the property and the third is a comma-delimited list of parameters. For example, the scale can be added a follows:

set(id, "sale", "xmin=0, xmax=2, autoscalx=false");

Parameters:
id - the identifier of the object
name - the type of property to be created.
parList - a list of parameters
Returns:
true if successful

setAnimationSlave

public boolean setAnimationSlave(int masterID,
                                 int slaveID)
Force an object to follow another object on the screen.
Parameters:
masterID - The id of the master object.
slaveID - The id of the slave object.
Returns:
true if successful.

setAutoRefresh

public void setAutoRefresh(boolean ar)
Repaint whenevers the system parameters are changed.
Overrides:
setAutoRefresh in class SApplet
Parameters:
autoRefresh - Automatic repaint?

setBz

public void setBz(double bz)
Set the z component of the magnetic field.
Parameters:
bz - The magnetic field in the z directon.

setCaption

public void setCaption(java.lang.String c)
Set the caption.
Parameters:
c - The caption string.

setChargeLabel

public void setChargeLabel(java.lang.String l)
Set the charge label. See also setLabel to change the label of any object.
Parameters:
l - All subsequent charges will show this label in the middle of the charge.

setChargeMagnitude

public boolean setChargeMagnitude(int id,
                                  double mag)
Set the magnitude for a charge.
Parameters:
id - The ID of the object.
mag - The magnitude.

setChargeRGB

public void setChargeRGB(int r,
                         int g,
                         int b)
Set the color for new charges.
Parameters:
r - red.
g - green.
b - blue.

setChargeTrail

public void setChargeTrail(int t)
Set the animation the default trail length.
Parameters:
t - The default trail points to draw in the animation behind a moving charge.

setConstrainR

public boolean setConstrainR(int id,
                             double r,
                             double x,
                             double y)
Constrain the motion of the test charges to a circular path.
Parameters:
r - The r value.
x - The x coordinate of the center
y - The y coordinate of the center
Returns:
True if successful.

setConstraintStr

public boolean setConstraintStr(int id,
                                java.lang.String str,
                                double xmin,
                                double xmax)
Constrain the motion of the test charges to a path given my F(x).
Parameters:
str - The function string F(x).
xmin - The minimum value of the range.
xmax - The maximum value of the range.
Returns:
True if successful.

setConstrainX

public boolean setConstrainX(int id,
                             double x,
                             double xmin,
                             double xmax)
Constrain the motion of the test charges to a path of constant x.
Parameters:
x - The x value.
xmin - The minimum value of the range.
xmax - The maximum value of the range.
Returns:
True if successful.

setConstrainY

public boolean setConstrainY(int id,
                             double y,
                             double ymin,
                             double ymax)
Constrain the motion of the test charges to a path of constant y.
Parameters:
y - The y value.
ymin - The minimum value of the range.
ymax - The maximum value of the range.
Returns:
True if successful.

setDamping

public boolean setDamping(int id,
                          double d)
Set the color for an object. Currently works for test charges and poles.
Parameters:
id - The ID of the object.
d - The damping coeficient in the rate equation. F_damp=-damping*velocity.
Returns:
True if successful.

setDampOnMousePressed

public void setDampOnMousePressed(boolean damp)
Set the velocity of an object to zero if it is being dragged.
Parameters:
damp - the velocity?

setDefault

public void setDefault()
Sets the default conditions. Hide field lines. Hide vector field. Disable charge drag. Do not show test charge velocity. Do not show force on charge.
Overrides:
setDefault in class SApplet

setDisplayOffset

public boolean setDisplayOffset(int id,
                                int xOff,
                                int yOff)
Offset the object's position on the screen from its default drawing position.
Parameters:
id - The id of the object.
xoff - The x offset.
yoff - The y offset.
Returns:
True if successful.

setDrag

public void setDrag(boolean drag)
Set drag for all subsequently created charges.
Parameters:
drag - Drag?

setDragable

public boolean setDragable(int id,
                           boolean drag)
Make the object with the given id dragable.
Parameters:
id - The id of the object.
drag - Dragable?
Returns:
True if successful.

setFieldResolution

public void setFieldResolution(int r)
Set the field resolution determines how the spacing of the field vectors on the grid. A resoluton of 2 would skip every other grid point when calculating the field vectors.
Parameters:
r - the resolution

setFont

public boolean setFont(int id,
                       java.lang.String family,
                       int style,
                       int size)
change the object's font for any text that is displayed.
Parameters:
id - The id of the object.
family - The font family: Helvetica, Times.
style - The style, 0=plain, 1=bold.
size - The size of the font;
Returns:
True if successful.

setFootPrints

public boolean setFootPrints(int id,
                             int n)
Set the trail to leave footprints as the charge moves.
Parameters:
id - The id of the object.
n - The number of points to skip between trail footprints or ghost images.
Returns:
True if successful.

setFormat

public boolean setFormat(int id,
                         java.lang.String fstr)
Change the object's format for the display of numeric data. Us this method to control the number of significant digits in calculations with text objects. Use Unix printf conventions. For example fstr="%6.3f"
Parameters:
id - The id of the object.
fstr - the format string.
Returns:
True if successful.

setGhost

public boolean setGhost(int id,
                        boolean ghost)
Have the charge draw ghost images as it moves. Use footprints to set the spacing.
Parameters:
id - The id of the object.
ghost - Draw ghost?
Returns:
True if successful.

setGridSize

public void setGridSize(int n)
Set the grid size for the evaluation of the potential energy.
Parameters:
n - the size of the grid

setHideCharge

public void setHideCharge(boolean hc)
Hide all charges.
Parameters:
hc - HidCharge parameter.

setLabel

public boolean setLabel(int id,
                        java.lang.String label)
Make the object label.
Parameters:
id - The id of the object.
label - The label string.
Returns:
True if successful.

setMass

public boolean setMass(int id,
                       double m)
Set the mass of an object.
Parameters:
id - The id of the object.
m - The new mass.
Returns:
True if successful.

setMaxTime

public void setMaxTime(double max,
                       java.lang.String msg)
Stop the simulation at a predetermined time and display a message for the user.
Parameters:
max - Stop the simulation when t=max and continue simulation.
msg - Display a user message.

setOnScreenSize

public boolean setOnScreenSize(int id,
                               int size)
Set the size for an object.
Parameters:
id - The ID of the object.
r - red.
g - green.
b - blue.
Returns:
True if successful.

setPointChargeMode

public void setPointChargeMode(boolean pcm)
Set point charge to produce 1/(r*r) field. Setting this parameter false will produce 1/r field.
Parameters:
pcm - Set point charge mode

setPotential

public void setPotential(java.lang.String ps,
                         double xmin,
                         double xmax,
                         double ymin,
                         double ymax)
Set the potential function. Y values are set so as to preserve an aspect ration of 1.
Parameters:
ps - The potential function, f(x,y).
xmin - x minimum
xmax - x maximum
ymin - approximate y minimum
ymax - approximate y maximum

setRGB

public boolean setRGB(int id,
                      int r,
                      int g,
                      int b)
Set the color for an object. Currently works for test charges and poles.
Parameters:
id - The ID of the object.
r - red.
g - green.
b - blue.
Returns:
Tue if successful.

setSeriesRGB

public void setSeriesRGB(int id,
                         int r,
                         int g,
                         int b)
Set the series line and marker color.
Parameters:
id - The series id.
r - red.
g - green.
b - blue.

setSeriesStyle

public void setSeriesStyle(int id,
                           boolean conPts,
                           int m)
Set the series style for the graoh object.
Parameters:
id - The series id.
conPts - Connect the points?
m - Marker style. (m=1 is cross; m=2 is square, m=3 is circle)

setShowCharge

public void setShowCharge(boolean sc)
Display all fixed charges on the screen.
Parameters:
sc - Show the charges on the screen.

setShowConstraintPath

public void setShowConstraintPath(int id,
                                  boolean sc)
Show a the constraint function that test particles must follow.
Parameters:
sc - Show the path?

setShowContours

public void setShowContours(boolean sc)
Show the contour lines.
Parameters:
sc - Show contours.

setShowCoordOnDrag

public void setShowCoordOnDrag(boolean sc)
Show the coordinates on a mouse drag.
Parameters:
sc - Show the coordinates.

setShowEOnDrag

public void setShowEOnDrag(boolean se)
Show the field at the mouse postion on a mouse drag.
Parameters:
se - Show the field.

setShowEquipotentialOnClick

public void setShowEquipotentialOnClick(boolean sp)
Draw equipotential starting at the mouse click.
Parameters:
sfl - Enable field line on click.

setShowEquipotentialOnDoubleClick

public void setShowEquipotentialOnDoubleClick(boolean sp)
Draw equipotential starting at the mouse double click.
Parameters:
sfl - Enable field line on double click.

setShowFComponents

public boolean setShowFComponents(int id,
                                  boolean sc)
Enable the charge force vector to show components when it is drawn. Works for test charges and poles.
Parameters:
id - The ID of the charge.
sc - Show the vector?
Returns:
True if successful.

setShowFieldLineOnClick

public void setShowFieldLineOnClick(boolean sfl)
Draw a field line starting at the mouse click.
Parameters:
sfl - Enable field line on click.

setShowFieldLineOnDoubleClick

public void setShowFieldLineOnDoubleClick(boolean sfl)
Draw a field line starting at the mouse double click.
Parameters:
sfl - Enable field line on double click.

setShowFieldLines

public void setShowFieldLines(boolean sfl)
Show the field lines.
Parameters:
sfl - Show field line.

setShowFieldVectors

public void setShowFieldVectors(boolean sfv)
Show the direction field vectors.
Parameters:
sfv - Show field line vectors.

setShowFOnDrag

public boolean setShowFOnDrag(int id,
                              boolean sfm)
Enable the charge to show the force magnitude in the message box.
Parameters:
id - The ID of the charge.
sfm - Show the force magnitude?

setShowForce

public void setShowForce(boolean sf)
Show the default to show the force vector on all subsequently created test charges.
Parameters:
sf - Show the force?

setShowFVector

public boolean setShowFVector(int id,
                              boolean sf)
Enable the charge to show the net force vector when it is drawn. Works for test charges and poles.
Parameters:
id - The ID of the charge.
sf - Show the vector?
Returns:
True if successful.

setShowLabels

public void setShowLabels(boolean sl)
Show the contour labels.
Parameters:
sl - Show contour labels?

setShowTime

public void setShowTime(boolean st)
Show the simulation time.
Parameters:
st - Show the time?

setShowVComponents

public boolean setShowVComponents(int id,
                                  boolean svc)
Enable the charge velocity vector to show components when it is drawn. Works for test charges and poles.
Parameters:
id - The ID of the charge.
svc - Show the vector components?
Returns:
True if successful.

setShowVelocity

public void setShowVelocity(boolean sv)
Show the default to show the velocity vector on newly created test charges.
Parameters:
sv - Show the velocity?

setShowVOnDrag

public void setShowVOnDrag(boolean sv)
Show the potential at the mouse postion on a mouse drag.
Parameters:
sv - Show the voltage?

setShowVVector

public boolean setShowVVector(int id,
                              boolean sv)
Enable the charge to show the net velocity vector when it is drawn. Works for test charges and poles.
Parameters:
id - The ID of the charge.
sv - Show the velocity vector?

setSketchMode

public int setSketchMode(boolean sketch)
Enable sketching with the mouse.
Parameters:
sketch - true will sketch
Returns:
int the id of the mouse data source

setSpeed

public boolean setSpeed(int id,
                        double speed)
Change the speed of a test charge. Direction of motion remains unchanged.
Parameters:
id - The ID of the charge.
speed - Show new speed.
Returns:
True if successful.

setSticky

public boolean setSticky(int id,
                         boolean isSticky)
Make the object stickey so that collisions stop the animation.
Parameters:
id - The id of the object.
stick - Sticky?
Returns:
True if successful.

setTimeContinuous

public void setTimeContinuous()
Let the simulation continue forever.
Overrides:
setTimeContinuous in class SApplet

setTimeCycle

public void setTimeCycle(double max)
Cycle the simulation
Overrides:
setTimeCycle in class SApplet
Parameters:
max - Reset the simulation to t=0 when t>=max and repeat the simulation.

setTimeOneShot

public void setTimeOneShot(double max,
                           java.lang.String msg)
Run the simulaiton one time.
Overrides:
setTimeOneShot in class SApplet
Parameters:
max - Reset the simulation to t=0 when t>=max and stop the simulation.
string - the message to be displayed on the screen when the max time is reached.

setTimeVisibility

public void setTimeVisibility(boolean visible)
Enable the time display in the applet window.
Parameters:
boolean - Show the time?

setTolerance

public void setTolerance(double t)
Set the tolerance for the animation calculations. Default is 1 part in 1.0e-5.

setTrail

public boolean setTrail(int id,
                        int pts)
Set the trail behind a charge. Zero will remove the trail.
Parameters:
id - The ID of the object.
pts - Trail length.
Returns:
True if successful.

setTrajectory

public boolean setTrajectory(int id,
                             java.lang.String xStr,
                             java.lang.String yStr)
Set the trajectory of a pole.
Parameters:
id - The ID of the pole.
xStr - The function x(t).
yStr - The function y(t).
Returns:
True if the functions are valid and the trajectory has been set.

setVisibility

public boolean setVisibility(int id,
                             boolean show)
Show the visibility of the object.
Parameters:
st - show object on screen?

setXRange

public void setXRange(double xmin,
                      double xmax)
Set the scale using the horizontal axis. The leftmost pixel will be xmin. The rightmost pixel will be xmax. The vertical axis will be rescaled to maintian an aspect ratio of one.
Parameters:
xmin - Minimuum value on x axis.
xmax - Maximum value on x axis.

setXY

public boolean setXY(int id,
                     double x,
                     double y)
Set position of an object.
Parameters:
id - The ID of the object.
x - The x coordinate.
y - The y coordinate.

setYRange

public void setYRange(double ymin,
                      double ymax)

start

public void start()
Overrides:
start in class java.applet.Applet

stepBack

public void stepBack()

stepForward

public void stepForward()

stepTimeBack

public void stepTimeBack()
Step the simulation one negative time step.
Overrides:
stepTimeBack in class SApplet

stepTimeForward

public void stepTimeForward()
Step the simulation one positive time step.
Overrides:
stepTimeForward in class SApplet

stop

public void stop()
Overrides:
stop in class java.applet.Applet

Copyright Wolfgang Christian

Visit the Davidson CollegePhyslets Page