All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class bfield.BField

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----bfield.BField

public class BField
extends Applet

Constructor Index

 o BField()

Method Index

 o addCoil(double, double, double)
Add add a single coil.
 o addWire(double, double, double)
Add add a Wire.
 o destroy()
 o getAppletInfo()
 o getParameter(String, String)
 o getParameterInfo()
 o init()
 o setBFunctions(String, String, double, double, double, double)
Set an external magnetic field.
 o setCurrent(int, double)
Change the current of a wire or loop after it has been created.
 o setDefault()
Clear all the wires and coils and set the applet into a predfined state.
 o setDefaultLabel(String)
Set the default label that will be drawn inside a wire.
 o setDefaultRGB(int, int, int)
Set the default red, green, and blue color values for all subsequent wires and coils.
 o setDrag(int, boolean)
Change the drag property of a wire or loop after it has been created.
 o setHide(int, boolean)
Hide an current from the user.
 o setHideWire(boolean)
wires and coils will be created as hidden objects by default.
 o setLabel(int, String)
Change the label property of a wire or loop after it has been created.
 o setOptionDrag(int, boolean)
Change the option drag property of a wire or loop after it has been created.
 o setRadius(int, double)
Change the radius of a loop after it has been created.
 o setRGB(int, int, int, int)
Set the red, green, and blue color values for a wire or coil that has already been created.
 o setShowBOnDrag(boolean)
Enable a the user to read the magnetic field magnitude by click-dragging the mouse.
 o setShowControls(boolean)
Enable interactive controls.
 o setShowCoordOnDrag(boolean)
Enable a the user to read coordinates by click-dragging the mouse.
 o setShowFieldLineOnClick(boolean)
Enable the user to click in order to draw a magnetic field line.
 o setShowFieldLineOnDoubleClick(boolean)
Enable the user to double click in order to draw a magnetic field line.
 o setShowFieldVectors(boolean)
Show the direction field.
 o setShowForce(int, boolean)
Enable a wire to show the net force vector.
 o setShowInfo(int, boolean)
Enable an object to show information such as the current.
 o start()
Start the applet thread.
 o stop()

Constructors

 o BField
 public BField()

Methods

 o getParameter
 public String getParameter(String key,
                            String def)
 o init
 public void init()
Overrides:
init in class Applet
 o start
 public void start()
Start the applet thread. Need not be called from JavaScript. Called by the browser after the applet loads.

Overrides:
start in class Applet
 o stop
 public void stop()
Overrides:
stop in class Applet
 o destroy
 public void destroy()
Overrides:
destroy in class Applet
 o getAppletInfo
 public String getAppletInfo()
Overrides:
getAppletInfo in class Applet
 o getParameterInfo
 public String[][] getParameterInfo()
Overrides:
getParameterInfo in class Applet
 o addWire
 public int addWire(double x,
                    double y,
                    double c)
Add add a Wire.

Parameters:
x - The x position.
y - The y position.
c - The current.
Returns:
The id for the object that was created. Can be used later to set object properties.
See Also:
addCoil, setBFunctions
 o addCoil
 public int addCoil(double x,
                    double y,
                    double c)
Add add a single coil. Will be drawn as a cross section.

Parameters:
x - The x position.
y - The y position.
c - The current.
Returns:
The id for the object that was created. Can be used later to set object properties.
See Also:
addWire, setBFunctions
 o setBFunctions
 public void setBFunctions(String bx,
                           String by,
                           double xmin,
                           double xmax,
                           double ymin,
                           double ymax)
Set an external magnetic field. The field generated by this function is added to the field generated by the fixed charges.

Parameters:
bx - Bx(x,y)
by - By(x,y)
xmin - The x minimum value.
xmax - The x maximum value.
ymin - The y minimum value.
ymax - The y maximum value.
See Also:
addWire, addCoil
 o setDefault
 public void setDefault()
Clear all the wires and coils and set the applet into a predfined state.

 o setShowFieldLineOnClick
 public void setShowFieldLineOnClick(boolean sfl)
Enable the user to click in order to draw a magnetic field line. CAUTION: May be subject to numerical error if field lines are drawn too close to wire where the radius of curvature is large.

Parameters:
sfl - Boolean value.
 o setShowFieldLineOnDoubleClick
 public void setShowFieldLineOnDoubleClick(boolean sfl)
Enable the user to double click in order to draw a magnetic field line. CAUTION: May be subject to numerical error if field lines are drawn too close to wire where the radius of curvature is large.

Parameters:
sfl - Boolean value.
 o setShowFieldVectors
 public void setShowFieldVectors(boolean sfv)
Show the direction field. Arrows are of unit length. Color is used to represent magnitude.

Parameters:
sfv - Boolean value.
 o setRGB
 public boolean setRGB(int id,
                       int r,
                       int g,
                       int b)
Set the red, green, and blue color values for a wire or coil that has already been created. Color values must be in the range 0..255.

Parameters:
id - The id for the wire or loop.
r - red.
g - green.
b - blue.
 o setLabel
 public boolean setLabel(int id,
                         String str)
Change the label property of a wire or loop after it has been created. Labels are usually single character identifies. Use the id returned by the add methods to identify the object you wish to change.

Parameters:
id - The id for the wire or loop.
str - The new label.
 o setDrag
 public boolean setDrag(int id,
                        boolean isDrag)
Change the drag property of a wire or loop after it has been created. Use the id returned by the add methods to identify the object you wish to change.

Parameters:
id - The id for the wire or loop.
isDrag - The new current.
 o setOptionDrag
 public boolean setOptionDrag(int id,
                              boolean isDrag)
Change the option drag property of a wire or loop after it has been created. Enables a user to click-drag on a loop in order to change a loop's radius. Use the id returned by the add methods to identify the object you wish to change.

Parameters:
id - The id for the wire or loop.
isDrag - The new current.
 o setCurrent
 public boolean setCurrent(int id,
                           double c)
Change the current of a wire or loop after it has been created. Use the id returned by the add methods to identify the object you wish to change.

Parameters:
id - The id for the wire or loop.
c - The new current.
 o setRadius
 public boolean setRadius(int id,
                          double r)
Change the radius of a loop after it has been created. Use the id returned by the add methods to identify the object you wish to change.

Parameters:
id - The id for the wire or loop.
r - The new radius.
 o setShowForce
 public boolean setShowForce(int id,
                             boolean showForce)
Enable a wire to show the net force vector. Use the id returned by the add methods to identify the object you wish to change.

Parameters:
id - The id for the wire or loop.
showForce - Boolean value.
 o setShowInfo
 public boolean setShowInfo(int id,
                            boolean showInfo)
Enable an object to show information such as the current. Use the id returned by the add methods to identify the object you wish to change.

Parameters:
id - The id for the wire or loop.
showInfo - Boolean value.
 o setHide
 public boolean setHide(int id,
                        boolean hide)
Hide an current from the user. Object will not be drawn but will effect the field. Use the id returned by the add methods to identify the object you wish to change.

Parameters:
id - The id for the wire or loop.
hide - Boolean value
 o setShowCoordOnDrag
 public void setShowCoordOnDrag(boolean sc)
Enable a the user to read coordinates by click-dragging the mouse.

Parameters:
sc - Boolean value.
 o setShowBOnDrag
 public void setShowBOnDrag(boolean sb)
Enable a the user to read the magnetic field magnitude by click-dragging the mouse.

Parameters:
sb - Boolean value.
 o setShowControls
 public void setShowControls(boolean sc)
Enable interactive controls. Useful for testing but usually false for scripted problems.

Parameters:
sc - Boolean value.
 o setHideWire
 public void setHideWire(boolean hw)
wires and coils will be created as hidden objects by default. Eliminates screen flash if objects are first created and then hidden. Should be set before the add methods are called.

Parameters:
hw - Boolean value.
 o setDefaultRGB
 public void setDefaultRGB(int r,
                           int g,
                           int b)
Set the default red, green, and blue color values for all subsequent wires and coils. Color values must be in the range 0..255. The default is to color code the direction of currcent flow.

Parameters:
r - red.
g - green.
b - blue.
 o setDefaultLabel
 public void setDefaultLabel(String str)
Set the default label that will be drawn inside a wire. Should be a single character. All subsequent wires will carry this label.

Parameters:
str - The label

All Packages  Class Hierarchy  This Package  Previous  Next  Index