reflection
Class ReflectionApplet

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byedu.davidson.tools.SApplet
                      extended byreflection.ReflectionApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ReflectionApplet
extends SApplet

Class ReflectionApplet

See Also:
Serialized Form

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 addMedium(double n, double w)
          Deprecated. Replaced by the addObject(String String) method.
 int addObject(java.lang.String name, java.lang.String parList)
          Create an object and add it to the Physlet.
 void forward()
          Starts the animation.
 double getQMEnergy()
          Gets the energy of the QM state.
 double getReflection()
          Gets the reflection coef.
 double getTransmission()
          Gets the tranmission coef.
 int getWaveID()
          Gets the object identifier for the wave data source.
 void pause()
          Pauses the animation.
 void recalculate()
          Method recalculates waves.
 void removeAllMedia()
          Method removes all objects from animation
 void removeObject(int id)
          Remove an object from the applet.
 void reverse()
          Reverses the animation.
 void setAmpDisplay(boolean show)
          Enable the amplitude display on with click-drag.
 void setAutoRefresh(boolean autoRefresh)
          Turns auto-refresh feature on and off.
 void setCoordDisplay(boolean show)
          Enable the coordinate display on with click-drag.
 void setDefault()
          Method sets default parameters for this applet.
 boolean setDragable(int id, boolean drag)
          Make the object with the given id dragable.
 void setDragEnergy(int id, boolean drag)
          Allows the user to adjust the energy or index of refraction by dragging up and down inside an element.
 void setEnergyDisplay(boolean show)
          Enable the energy display in the applet window.
 boolean setFont(int id, java.lang.String family, int style, int size)
          Change the object's font for any text that is displayed.
 boolean setFormat(int id, java.lang.String fstr)
          Change the object's format for the display of numeric data.
 void setIndexN(int id, double n)
          Method sets index of refraction of a medium
 void setLabel(int id, java.lang.String label)
          Add a small label at bottom center of a medium
 void setMagMax(double max)
          Method sets Max amplitude in units.
 void setMediaWidth(int id, double w)
          Method sets the width of a given medium
 void setMessage(java.lang.String msg)
          Method adds small text box in lower right hand corner of screen Turned off by setDefault();
 void setMode(java.lang.String m)
          Sets applet in EM or QM mode
 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 setPhaseDisplay(boolean show)
          Enable the phase display on with click-drag.
 void setPPU(double ppu)
          Method sets pixels per unit
 void setQMEnergy(double en)
          Sets the energy of the QM state.
 void setQMPotential(int id, double v)
          Sets the potential energy of the layer.
 void setRGB(int id, int r, int g, int b)
          Method sets color of a medium
 void setShowControls(boolean s)
          Method setShowControls
 void setShowLWave(boolean show, int pixOffset)
          Enable the display of the left traveling wave or the imaginary part of the wavefunction.
 void setShowPhaseColor(boolean show)
          Method enables the display of color for phase in QM mode.
 void setShowRWave(boolean show, int pixOffset)
          Enable the display of the right traveling wave or the real part of the wavefunction.
 boolean setShowValue(int id, boolean tf)
          Enable the display of either the index of refraction or the potential
 void setShowWave(boolean show)
          Enable the display of the total wave.
 void setTimeDisplay(boolean show)
          Enable the time display in the applet window.
 void setTitle(java.lang.String str)
          Set the title.
 boolean setVisibility(int id, boolean vis)
          Show the visibility of the object.
 void setWavelength(double lambda)
          method sets wavelength of incident wave in free space
 void setWaveVelocity(double v)
          Method sets velocity of animated wave in units per time Positive velocity moves wave to right.
 void step()
          Steps the animation.
 void stepBack()
          Method stepBack
 void stepForward()
          Method stepForward
 void stepTimeBack()
          Step the time backward by dt.
 void stepTimeForward()
          Step the time by dt.
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, checkAppletNames, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, formatValue, getAppletName, getClockID, getClockTime, getDataFromDS, getDataListener, getDataSource, getDataSource, getDebugLevel, getID, getSourceData, getSourceVariables, isClockRunning, isValidFunction, makeDataConnection, removeDataListener, removeDataSource, reset, sendDataToListener, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setConnectionWindowX, setConnectionWindowY, setDebugLevel, setDt, setExternalClock, setFPS, setIndependentClock, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stop, stopClock, updateDataConnection, 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, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

setShowControls

public void setShowControls(boolean s)
Method setShowControls

Parameters:
s -

setDefault

public void setDefault()
Method sets default parameters for this applet. Should be called at the begining of a set of script.

Overrides:
setDefault in class SApplet

setMessage

public void setMessage(java.lang.String msg)
Method adds small text box in lower right hand corner of screen Turned off by setDefault();

Parameters:
msg - String to be displayed

setIndexN

public void setIndexN(int id,
                      double n)
Method sets index of refraction of a medium

Parameters:
id - the object identifier
n - the index of refraction

setDragEnergy

public void setDragEnergy(int id,
                          boolean drag)
Allows the user to adjust the energy or index of refraction by dragging up and down inside an element. If id==0, the total energy can be adjusted. Otherwise, the potential energy of the element is adjusted.

Parameters:
id - the object identifier
drag - boolean

setPPU

public void setPPU(double ppu)
Method sets pixels per unit

Parameters:
ppu - double

setQMEnergy

public void setQMEnergy(double en)
Sets the energy of the QM state.

Parameters:
en - the energy

getQMEnergy

public double getQMEnergy()
Gets the energy of the QM state.

Returns:
the energy

setQMPotential

public void setQMPotential(int id,
                           double v)
Sets the potential energy of the layer.

Parameters:
id - the object identifier for the layer
v - the potential energy

setMode

public void setMode(java.lang.String m)
Sets applet in EM or QM mode

Parameters:
m - String "EM" or "QM"

pause

public void pause()
Pauses the animation.

Overrides:
pause in class SApplet

forward

public void forward()
Starts the animation.

Overrides:
forward in class SApplet

reverse

public void reverse()
Reverses the animation.

Overrides:
reverse in class SApplet

step

public void step()
Steps the animation.


stepTimeForward

public void stepTimeForward()
Step the time by dt.

Overrides:
stepTimeForward in class SApplet
See Also:
SApplet.setDt(double)

stepForward

public void stepForward()
Method stepForward


stepTimeBack

public void stepTimeBack()
Step the time backward by dt.

Overrides:
stepTimeBack in class SApplet
See Also:
SApplet.setDt(double)

stepBack

public void stepBack()
Method stepBack


setWaveVelocity

public void setWaveVelocity(double v)
Method sets velocity of animated wave in units per time Positive velocity moves wave to right.

Parameters:
v - double

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 layer if width and index of refraction 2.4 can be added a follows:

addObject ("layer", "w=1.5, n=2.4");

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.

removeObject

public void removeObject(int id)
Remove an object from the applet.

Parameters:
id -

addMedium

public int addMedium(double n,
                     double w)
Deprecated. Replaced by the addObject(String String) method.

Adds a medium with given index of refraction When creating several media, the order in which method is called is insignificant

Parameters:
n - double index of refraction
w - double width of medium in units
Returns:
int the object identifier

getWaveID

public int getWaveID()
Gets the object identifier for the wave data source.

Returns:
int the identifier

getReflection

public double getReflection()
Gets the reflection coef.

Returns:
double R

getTransmission

public double getTransmission()
Gets the tranmission coef.

Returns:
double T

removeAllMedia

public void removeAllMedia()
Method removes all objects from animation


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.

setRGB

public void setRGB(int id,
                   int r,
                   int g,
                   int b)
Method sets color of a medium

Parameters:
id - the object identifier
r - red value 0 <= r <= 255
g - green value 0 <= g <= 255
b - blue value 0 <= b <= 255

setMagMax

public void setMagMax(double max)
Method sets Max amplitude in units. All waves will be scaled down accordingly.

Parameters:
max - double

setWavelength

public void setWavelength(double lambda)
method sets wavelength of incident wave in free space

Parameters:
lambda - wavelength in units

setMediaWidth

public void setMediaWidth(int id,
                          double w)
Method sets the width of a given medium

Parameters:
id - int hashcode id of medium
w -

recalculate

public void recalculate()
Method recalculates waves. Should be called each time an index of refraction (or potential) changes, or a new medium is added.


setAutoRefresh

public void setAutoRefresh(boolean autoRefresh)
Turns auto-refresh feature on and off. Whenever some significant parameter (like width or wavelength) is updated, the calculations and painting will be performed again, unless autoRefresh is turned off.

Overrides:
setAutoRefresh in class SApplet
Parameters:
autoRefresh - boolean

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. An id of zero will change the font for the time display in the wave panel.

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.

setObjectFont

public 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.

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.

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.

setLabel

public void setLabel(int id,
                     java.lang.String label)
Add a small label at bottom center of a medium

Parameters:
id - the object identifier
label - the label

setTitle

public void setTitle(java.lang.String str)
Set the title.

Parameters:
str - Title string.

setEnergyDisplay

public void setEnergyDisplay(boolean show)
Enable the energy display in the applet window.

Parameters:
show - true will display energy

setTimeDisplay

public void setTimeDisplay(boolean show)
Enable the time display in the applet window.

Parameters:
show - true will display time

setAmpDisplay

public void setAmpDisplay(boolean show)
Enable the amplitude display on with click-drag.

Parameters:
show - true will display amplitude

setCoordDisplay

public void setCoordDisplay(boolean show)
Enable the coordinate display on with click-drag.

Parameters:
show - true will display coordinates

setPhaseDisplay

public void setPhaseDisplay(boolean show)
Enable the phase display on with click-drag.

Parameters:
show - true will display phase

setShowValue

public boolean setShowValue(int id,
                            boolean tf)
Enable the display of either the index of refraction or the potential

Parameters:
id - the object identifier
tf - boolean enable or disable
Returns:
true if successful

setVisibility

public boolean setVisibility(int id,
                             boolean vis)
Show the visibility of the object.

Parameters:
id -
vis - show object on screen?
Returns:
true if successful

setShowWave

public void setShowWave(boolean show)
Enable the display of the total wave.

Parameters:
show - the wave

setShowLWave

public void setShowLWave(boolean show,
                         int pixOffset)
Enable the display of the left traveling wave or the imaginary part of the wavefunction.

Parameters:
show - the L wave
pixOffset -

setShowPhaseColor

public void setShowPhaseColor(boolean show)
Method enables the display of color for phase in QM mode.

Parameters:
show - the color

setShowRWave

public void setShowRWave(boolean show,
                         int pixOffset)
Enable the display of the right traveling wave or the real part of the wavefunction.

Parameters:
show - the R wave
pixOffset -


Visit the Davidson College Physlet Site for additional information.