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