|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
edu.davidson.tools.SApplet
optics.OpticsApplet
This applet simulates an optics bench containing lenses, mirrors, and sources.
Field Summary |
Fields inherited from class edu.davidson.tools.SApplet |
destroyed |
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 |
Method Summary | |
int |
addAperture(double x,
double openingSize)
Add a blocking aperture at x. |
int |
addApertureP(int x,
int openingSize)
Add a blocking aperture at x. |
int |
addDielectric(double x,
double dn,
double r)
Add a dielectric interface that can have a radius of curvature or none at all. |
int |
addDielectricP(int x,
double dn,
int r)
Add a dielectric interface that can have a radius of curvature or none at all. |
int |
addIndexChange(double x,
double delN)
Add an index change that has no curvature. |
int |
addIndexChangeP(int x,
double dn)
Add an index change that has no curvature. |
int |
addISource(double x,
double y,
int size,
double angle)
Adds an infinite source with parallel rays. |
int |
addISourceP(int x,
int y,
int size,
double angle)
Adds an infinite source with parallel rays. |
int |
addLens(double x,
double fl)
Adds a thin lens, no spherical aberration, based on matrix transformations. |
int |
addLensP(int x,
double fl)
Adds a thin lens, no spherical aberration, based on matrix transformations. |
int |
addMirror(double x,
double fl)
Adds an ideal mirror, based on matrix transformations. |
int |
addMirrorP(int x,
double fl)
Adds an ideal mirror, based on matrix transformations. |
int |
addObject(java.lang.String name,
java.lang.String parList)
Create an object and add it to the Physlet. |
int |
addPSource(double x,
double y)
Adds an principal-ray source which draws the three principal rays. |
int |
addPSourceP(int x,
int y)
Adds an principal-ray source which draws the three principal rays. |
int |
addRefraction(double x,
double delN,
double r)
Adds a refraction interface that can represent a thick lens with spherical aberration and internal reflection. |
int |
addRefractionP(int x,
double delN,
int rT)
Adds a refraction interface that can represent a thick lens with spherical aberration and internal reflection. |
int |
addScreen(double x)
Adds a screen. |
int |
addScreenP(int x)
Adds a screen using pixel units. |
int |
addSource(double x,
double y,
double rayIncrement,
double raySlope)
Adds a regular point source, with spreading rays from a single point. |
int |
addSourceP(int x,
int y,
double rayIncrement,
double raySlope)
Adds a regular point source, with spreading rays from a single point. |
int |
addSphericalMirror(double x,
double fl)
Adds a spherical mirror. |
int |
addSphericalMirrorP(int x,
double fl)
Adds an spherical mirror. |
void |
clearAll()
Clears all elements from bench and repaints |
void |
deleteActiveElement()
Delete the active element from the applet. |
boolean |
deleteObject(int id)
Delete an object from the applet. |
double |
getFocalLength(int id)
Get the element's focal length |
double |
getIndex(int id)
Get the element's index of refraction. |
double |
getX(int id)
Get the element's x position. |
double |
getXPos(int id)
Bug-fix to get the x of an object on Netscape and Sun. |
double |
getY(int id)
Get the element's y position. |
double |
getYPos(int id)
Bug-fix to get the y of an object on Netscape and Sun. |
int |
makeDataConnection(int sourceID,
int listenerID,
int seriesID,
java.lang.String xStr,
java.lang.String yStr)
Have the applet make a new data connection. |
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 every time the system parameters are changed. |
boolean |
setConstraint(int id,
int constraintID)
Set a motion constraint on an object. |
void |
setDefault()
Calls the following methods: setPixPerUnit(100), setInfo(false), setSize(.8), setDrag(false), setPropertyDrag(false), & setDirection(1) |
void |
setDirection(int d)
Set the direction that sources added after will start in |
boolean |
setDisplayOffset(int id,
int xOff,
int yOff)
Offset the object's position on the screen from its default drawing position. |
void |
setDrag(boolean d)
Determines if elements added after value is set will be allowed to be dragged |
boolean |
setDragable(int id,
boolean drag)
Change the drag property of a wire or loop after it has been created. |
void |
setElementRGB(int r,
int g,
int b)
Set the color of lenses and mirrors. 0,0,0 will reset default. |
void |
setElementSize(double s)
Bug-fix to set the size of the optic elements. |
void |
setInfo(boolean i)
Determines if elements added after value will show information on screen including focal lengths and positions |
boolean |
setObjectFont(int id,
java.lang.String family,
int style,
int size)
Sets the object's font if the object has text that can be displayed. |
void |
setPixPerUnit(int ppu)
Set the Pixels per Unit. |
void |
setPropertyDrag(boolean pd)
Determines if elements added after value is set will be allowed to have their properties changed by dragging |
void |
setRayRGB(int r,
int g,
int b)
Set the color of the source light rays. |
boolean |
setResizable(int id,
boolean isResizable)
Make an object resizable. |
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. |
boolean |
setShowFocus(int id,
boolean show)
Change the showFocus property. |
void |
setSize(java.awt.Dimension d)
|
void |
setSize(double s)
Set the size of the optic elements. |
void |
setSize(int w,
int h)
|
boolean |
setVisibility(int id,
boolean show)
Show the visibility of the object. |
void |
setX(int id,
double x)
Set the element's x position. |
void |
setXPos(int id,
double x)
Set the element's x position. |
void |
setXY(int id,
double x,
double y)
Set the element's x position. |
void |
setY(int id,
double y)
Set the element's y position. |
void |
setYPos(int id,
double y)
Set the element's y position. |
void |
updateDataConnection(int id)
updateDataConnections(); |
void |
updateDataConnections()
updateDataConnections(); |
Methods inherited from class java.applet.Applet |
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start |
Methods inherited from class java.awt.Panel |
addNotify |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, 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, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public boolean setDisplayOffset(int id, int xOff, int yOff)
id
- The id of the object.
public void clearAll()
public boolean setDragable(int id, boolean drag)
id
- the object identifierdrag
- true if dragable
public boolean setShowFocus(int id, boolean show)
id
- the object identifiershow
- true to show the focus
public boolean setConstraint(int id, int constraintID)
id
- the ID of the object.constraintID
- the ID of the constraint.
true
if successful.public void setDrag(boolean d)
d
- True or Falsepublic boolean setAnimationSlave(int masterID, int slaveID)
masterID
- The id of the master object.slaveID
- The id of the slave object.
public boolean setResizable(int id, boolean isResizable)
id
- the object identifier.
true
if successful.public void setPropertyDrag(boolean pd)
pd
- True or Falsepublic void setInfo(boolean i)
i
- True or Falsepublic void setElementRGB(int r, int g, int b)
r
- 0g
- 0b
- 0
public boolean setObjectFont(int id, java.lang.String family, int style, int size)
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;
public void setRayRGB(int r, int g, int b)
r
- 0g
- 0b
- 0
public boolean setRGB(int id, int r, int g, int b)
id
- The id for the wire or loop.r
- red.g
- green.b
- blue.public void setSize(double s)
s
- Size in the range 0 to 1.0public void setDirection(int d)
d
- d=1 or d=-1. d=1 is to the right. d=-1 is to the leftpublic void setPixPerUnit(int ppu)
ppu
- 100 pixels per unit is as if on the screen 100 pixels represents 1 meterpublic void setAutoRefresh(boolean ar)
setAutoRefresh
in class SApplet
ar
- Automatic repaint?public void setDefault()
setDefault
in class SApplet
public boolean setVisibility(int id, boolean show)
show
- true
will show object on screen
true
if successful false
otherwisepublic double getFocalLength(int id)
id
- The id of the element.
public double getX(int id)
id
- The id of the element.
public void setX(int id, double x)
id
- the id of the element.x
- the x position.public void setXY(int id, double x, double y)
id
- the id of the element.x
- the x position.public void setXPos(int id, double x)
id
- the id of the element.x
- the x position.public void setY(int id, double y)
id
- the id of the element.public void setYPos(int id, double y)
id
- the id of the element.y
- the x position.public double getY(int id)
id
- The id of the element.
public double getXPos(int id)
id
- The id of the object.
public double getYPos(int id)
id
- The id of the object.
public void setElementSize(double s)
s
- Size in the range 0 to 1.0public void setSize(java.awt.Dimension d)
public void setSize(int w, int h)
public double getIndex(int id)
id
- The id of the element.
public boolean set(int id, java.lang.String name, java.lang.String parList)
set(id, "lens", "x=3, f=-1");
id
- the identifier of the objectname
- the type of object to be set.parList
- a list of parameters
public int addObject(java.lang.String name, java.lang.String parList)
addObject ("circle", "x = 0, y = -1.0, r = 10");
name
- the type of object to be created.parList
- a list of parameters to be set
public boolean deleteObject(int id)
id
- the object identifier
public void deleteActiveElement()
public int makeDataConnection(int sourceID, int listenerID, int seriesID, java.lang.String xStr, java.lang.String yStr)
makeDataConnection
in class SApplet
sourceID
- The id of the data source.listenerID
- The id of the data listener. This is usually an applet.seriesID
- The id of the series in the data listener.xStr
- The function of the data source variables to be plotted on the horizontal axis.yStr
-
public void updateDataConnections()
updateDataConnections
in class SApplet
public void updateDataConnection(int id)
updateDataConnection
in class SApplet
id
- The integer id of the data source.public int addAperture(double x, double openingSize)
x
- The position of the aperture, in relative units specified by setPixPerUnit()openingSize
- 0<=openingSize<=1 \public int addDielectric(double x, double dn, double r)
x
- The position of the aperture, in relative units specified by setPixPerUnitdn
- Change in index of refraction from left to right.r
- The radius of curvature of the interface, in relative units.public int addIndexChange(double x, double delN)
x
- The position of the aperture, in relative units specified by setPixPerUnitdelN
- The change (+/-) of index going from left to right across interfacepublic int addRefraction(double x, double delN, double r)
x
- The x position of the refraction, in relative units specified by setPixPerUnit()delN
- The change in index of refraction when going from left to right across inferfacer
- The radius of curvature of the interface, specified in relative units.public int addISource(double x, double y, int size, double angle)
x
- The x position of the ISource, in relative units specified by setPixPerUnity
- The x position of the ISource, in relative units specified by setPixPerUnitsize
- The height from the top to bottom of the source, in pixelsangle
- The slope of the rays, -1public int addLens(double x, double fl)
x
- The x position of the lens, in relative units specified by setPixPerUnit()fl
- The focal length of the lens, in relative units specified by setPixPerUnit()public int addMirror(double x, double fl)
x
- The x position of the mirror, in relative units specified by setPixPerUnit()fl
- The focal length of the mirror, in relative units specified by setPixPerUnit()public int addSphericalMirror(double x, double fl)
x
- The x position of the mirror, in relative units specified by setPixPerUnit()fl
- The focal length of the mirror, in relative units specified by setPixPerUnit()public int addPSource(double x, double y)
x
- The x position of the PSource, in relative units specified by setPixPerUnit()y
- The y position of the PSource, in relative units specified by setPixPerUnit()public int addScreen(double x)
x
- The x position of the Screen, in relative units specified by setPixPerUnit()public int addSource(double x, double y, double rayIncrement, double raySlope)
x
- The x position of the Source, in relative units specified by setPixPerUnit()y
- The y position of the source, in relative units specified by setPixPerUnit()rayIncrement
- The delta slope between intervals of rays coming from the SourceraySlope
- The starting slope of the outermost rays (top and bottom)public int addApertureP(int x, int openingSize)
x
- The position of the aperture, in direct pixel unitsopeningSize
- 0<=openingSize<=1public int addDielectricP(int x, double dn, int r)
x
- The position of the aperture, in pixel unitsdn
- Change in index of refraction from left to right.r
- The radius of curvature of the interface, in pixel units.public int addIndexChangeP(int x, double dn)
x
- The position of the aperture, in pixel unitsdn
- The change (+/-) of index going from left to right across interfacepublic int addRefractionP(int x, double delN, int rT)
x
- The x position of the refraction, in pixel unitsdelN
- The change in index of refraction when going from left to right across inferfacepublic int addISourceP(int x, int y, int size, double angle)
x
- The x position of the ISource, in pixel unitsy
- The x position of the ISource, in pixel unitssize
- The height from the top to bottom of the source, in pixelsangle
- The slope of the rays, -1public int addLensP(int x, double fl)
x
- The x position of the lens, in pixel unitsfl
- The focal length of the lens, in pixel unitspublic int addMirrorP(int x, double fl)
x
- The x position of the mirror, in pixel unitsfl
- The focal length of the mirror, in pixel unitspublic int addSphericalMirrorP(int x, double fl)
x
- The x position of the mirror, in pixel unitsfl
- The focal length of the mirror, in pixel unitspublic int addPSourceP(int x, int y)
x
- The x position of the PSource, in pixel unitsy
- The y position of the PSource, in pixel unitspublic int addScreenP(int x)
x
- The x position of the Screen, in pixel unitspublic int addSourceP(int x, int y, double rayIncrement, double raySlope)
x
- The x position of the Source, in pixel unitsy
- The y position of the source, in pixel unitsrayIncrement
- The delta slope between intervals of rays coming from the source, typical value is .25raySlope
- The starting slope of the outermost rays (top and bottom), typical value is between 0 and 1
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |