|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.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.
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 |
Constructor Summary | |
OpticsApplet()
|
Method Summary | |
int |
addObject(java.lang.String name,
java.lang.String parList)
Create an object and add it to the Physlet. |
void |
clearAll()
Clears all elements from bench and repaints |
java.lang.String |
getAppletInfo()
|
double |
getFocalLength(int id)
Get the element's focal length |
double |
getIndex(int id)
Get the element's index of refraction. |
java.lang.String |
getParameter(java.lang.String key,
java.lang.String def)
|
java.lang.String[][] |
getParameterInfo()
|
double |
getX(int id)
Get the element's x position. |
double |
getY(int id)
Get the element's y position. |
void |
init()
|
void |
jbInit()
|
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. |
void |
setBtnOff()
Changes all the colors of the buttons to black |
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. |
void |
setInfo(boolean i)
Determines if elements added after value will show information on screen including focal lengths and positions |
void |
setNull()
Calls setBtnOff() and makes it so nothing is added when the mouse clicks the bench |
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(double s)
Set the szie of the optic elements. |
void |
setUnDefault()
Calls the following methods: setPixPerUnit(100), setInfo(true), setSize(.8), setDrag(true), setPropertyDrag(true), & setDirection(1) |
void |
start()
|
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,
stop |
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,
setCursor,
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,
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 |
public OpticsApplet()
Method Detail |
public java.lang.String getParameter(java.lang.String key, java.lang.String def)
public void init()
public void jbInit() throws java.lang.Exception
public void start()
public java.lang.String getAppletInfo()
public java.lang.String[][] getParameterInfo()
public boolean setDisplayOffset(int id, int xOff, int yOff)
id
- The id of the object.xoff
- The x offset.yoff
- The y offset.public void clearAll()
public boolean setDragable(int id, boolean drag)
id
- the object identifierdrag
- true if dragablepublic boolean setShowFocus(int id, boolean show)
id
- the object identifiershow
- true to show the focuspublic 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.resizable
- propertytrue
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 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)
ar
- Automatic repaint?public void setDefault()
public void setUnDefault()
public double getFocalLength(int id)
id
- The id of the element.public double getX(int id)
id
- The id of the element.public double getY(int id)
id
- The id of the element.public double getIndex(int id)
id
- The id of the element.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 setpublic void setNull()
public void setBtnOff()
|
Copyright Wolfgang Christian | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |