reflection
Class ReflectionApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--edu.davidson.tools.SApplet
                                |
                                +--reflection.ReflectionApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ReflectionApplet
extends SApplet

See Also:
Serialized Form

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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ReflectionApplet()
           
 
Method Summary
 int addObject(java.lang.String name, java.lang.String parList)
          Create an object and add it to the Physlet.
 void forward()
          Start the animation.
 java.lang.String getAppletInfo()
           
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
           
 java.lang.String[][] getParameterInfo()
           
 void init()
           
 void pause()
          Pause the clock.
 void recalculate()
          Method recalculates waves.
 void removeAllMedia()
          Method removes all media from animation
 void removeObject(int id)
          Remove an object from the applet.
 void reverse()
          Run Time in the reverse direction..
 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)
          Method sets applet in EM or QM mode
 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)
          Set the energy of the QM state.
 void setQMPotential(int id, double v)
          Set 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)
           
 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.
 void 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 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 start()
           
 void step()
          Step the animation.
 void stepBack()
           
 void 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, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, destroy, getClockID, getClockTime, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, makeDataConnection, removeDataListener, removeDataSource, reset, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setDt, setExternalClock, setFPS, setRunningID, setRunningID, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stopClock, updateDataConnection, updateDataConnections
 
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, 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, setCursor, 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

ReflectionApplet

public ReflectionApplet()
Method Detail

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.

forward

public void forward()
Start the animation.
Overrides:
forward in class SApplet

getAppletInfo

public java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet

getParameter

public java.lang.String getParameter(java.lang.String key,
                                     java.lang.String def)

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet

init

public void init()
Overrides:
init in class java.applet.Applet

pause

public void pause()
Description copied from class: SApplet
Pause the clock.
Overrides:
pause in class SApplet

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.

removeAllMedia

public void removeAllMedia()
Method removes all media from animation

removeObject

public void removeObject(int id)
Remove an object from the applet.
Parameters:
object - identifier

reverse

public void reverse()
Run Time in the reverse direction..
Overrides:
reverse in class SApplet

setAmpDisplay

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

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

setCoordDisplay

public void setCoordDisplay(boolean show)
Enable the coordinate display on with click-drag.
Parameters:
show - true will display coordinates

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

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.

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

setEnergyDisplay

public void setEnergyDisplay(boolean show)
Enable the energy display in the applet window.
Parameters:
show - true will display energy

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.

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.

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

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

setMagMax

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

setMediaWidth

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

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

setMode

public void setMode(java.lang.String m)
Method sets applet in EM or QM mode
Parameters:
m - String "EM" or "QM"

setPhaseDisplay

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

setPPU

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

setQMEnergy

public void setQMEnergy(double en)
Set the energy of the QM state.
Parameters:
en - the energy

setQMPotential

public void setQMPotential(int id,
                           double v)
Set the potential energy of the layer.
Parameters:
id - the object identifier for the layer
v - the potential energy

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

setShowControls

public void setShowControls(boolean s)

setShowLWave

public void setShowLWave(boolean show,
                         int pixOffset)
Enable the display of the left traveling wave or the imaginary part of the wavefunction.
Parameters:
the - vertical pixel offset for the wave
show - the L wave

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:
the - vertical pixel offset for the wave
show - the R wave

setShowValue

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

setShowWave

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

setTimeDisplay

public void setTimeDisplay(boolean show)
Enable the time display in the applet window.
Parameters:
show - true will display time

setWavelength

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

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

start

public void start()
Overrides:
start in class java.applet.Applet

step

public void step()
Step the animation.

stepBack

public void stepBack()

stepForward

public void stepForward()

stepTimeBack

public void stepTimeBack()
Step the time backward by dt.
Overrides:
stepTimeBack in class SApplet
See Also:
SApplet.setDt(double)

stepTimeForward

public void stepTimeForward()
Step the time by dt.
Overrides:
stepTimeForward in class SApplet
See Also:
SApplet.setDt(double)

Copyright Wolfgang Christian

Visit the Davidson CollegePhyslets Page