Class HSApplet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--BaseApplet
                                |
                                +--BaseApplet2
                                      |
                                      +--TimeDep
                                            |
                                            +--HSApplet

public class HSApplet
extends TimeDep
implements TimeDependent

Applet to demonstrate the Haynes-Shockley experiment. The function is animated as it changes over time. Graphs are provided, plotting the integral of the function, and the function seen by an observer at some fixed point; both of these are plotted with respect to time.

See Also:
Serialized Form

Inner classes inherited from class BaseApplet2
BaseApplet2.FixedButton, BaseApplet2.FixedCheckbox, BaseApplet2.GraphClickListener
 
Inner classes inherited from class BaseApplet
BaseApplet.MozillaWorkaround, BaseApplet.ResizeListener
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
protected  TimeGraph integral
           
protected  Plotter intPlotter
           
protected  java.awt.TextField lifetimeField
           
protected  int observations
          The number of time samples before the graphs "wrap around"
protected  TimeGraph observer
           
protected  java.awt.TextField obsField
           
protected  BaseApplet2.GraphClickListener obsListener
          Listener to detect changes in the position of the observer.
protected  double obsMax
          The largest value "seen" so far at the observation point
protected  Plotter obsPlotter
           
protected  int obsPoint
          The array index corresponding to the observation point
protected  double obsWidth
          The width of the observed gaussian, or zero if unknown
protected  double obsX
          The selected observation point
protected  double startIntegral
          The integral at the start of the simulation
 
Fields inherited from class TimeDep
anim, animButton, AXES_COL, DEFAULT_NWELLS, DEFAULT_STEPS, depthField, dt, dtField, dx, dxField, ENERGY_COL, energyField, eqn, fnStartField, fnWidthField, function, intWidth, intWidthField, nWellsField, plotter, POT_COL, potPlotter, quadBox, quadFunction, resetButton, stepButton, steps, WAVE_FN_COL, WELL_BOUNDS_COL, widthField
 
Fields inherited from class BaseApplet2
boxes, buttons, enablePrompt, fields, focus, panel, statusLabel, useSwing, V_MARGIN
 
Fields inherited from class BaseApplet
buffer, GRAPH_MARGIN, refresh, resizeListener, safetyLimit, useBuffer
 
Fields inherited from class java.applet.Applet
serialVersionUID, stub
 
Fields inherited from class java.awt.Panel
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, maxSize, ncomponents, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
HSApplet()
           
 
Method Summary
 void _init()
          Performs initialisation specific to the Haynes-Shockley experiment, not required by the time-dependent Schrodinger applet.
protected  void addControls()
          Adds GUI components to this applet.
 void advanceOnce()
          Performs one step of the simulation, and updates the graphs to reflect the changes.
 TimeDepSchrodinger createEqn()
          Returns the model to be used for this applet.
 void doPaint(java.awt.Graphics g)
          Called by forcePaint() to actually perform the painting.
 double getObservedWidth()
          Attempts to calculate the width of the (skewed) gaussian seen by the observer.
 double getT()
          Returns the time elapsed in the model.
 void init()
          Performs extra initialisation, including adding a panel to the bottom of the applet.
protected  boolean reset()
          Stops any running animation, resets the model to the initial function, and clears the graphs.
 void setObsX(double d)
          Sets the observation point.
 void start()
          Applets should use this method to perform any final initialisation necessary to "activate" the applet
 void stop()
          When this method is called, the applet should cease any user interaction.
 void updateInput()
          Reads in (and validates) input from the text fields.
 
Methods inherited from class TimeDep
_paint, actionPerformed, animate, killAnimation, step, validateInput
 
Methods inherited from class BaseApplet2
add, add, addButton, addCheckbox, addField, addField, addField, addListeners, focusGained, focusLost, getDouble, getGraphHeight, getInt, lockControls, makeButton, makePanel, paintDashedLineH, paintDashedLineV, register, removeListeners, setComponentsEnabled, setLayout, setPromptEnabled, textValueChanged, toString, unlockControls
 
Methods inherited from class BaseApplet
changeFont, forcePaint, getAppletInfo, getParameterInfo, itemStateChanged, paint, refresh, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName
 
Methods inherited from class java.awt.Container
add, add, add, add, addContainerListener, addImpl, applyOrientation, countComponents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getCursorTarget, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, nextFocus, paintComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printOneComponent, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFocusOwner, setFont, transferFocus, updateCursor, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getIntrinsicCursor, getLocation, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, 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, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

obsListener

protected BaseApplet2.GraphClickListener obsListener
Listener to detect changes in the position of the observer.

obsX

protected double obsX
The selected observation point

obsMax

protected double obsMax
The largest value "seen" so far at the observation point

startIntegral

protected double startIntegral
The integral at the start of the simulation

obsWidth

protected double obsWidth
The width of the observed gaussian, or zero if unknown

lifetimeField

protected java.awt.TextField lifetimeField

obsField

protected java.awt.TextField obsField

integral

protected TimeGraph integral

observer

protected TimeGraph observer

observations

protected int observations
The number of time samples before the graphs "wrap around"

obsPoint

protected int obsPoint
The array index corresponding to the observation point

intPlotter

protected Plotter intPlotter

obsPlotter

protected Plotter obsPlotter
Constructor Detail

HSApplet

public HSApplet()
Method Detail

init

public void init()
Description copied from class: BaseApplet2
Performs extra initialisation, including adding a panel to the bottom of the applet.
Overrides:
init in class TimeDep

_init

public void _init()
Performs initialisation specific to the Haynes-Shockley experiment, not required by the time-dependent Schrodinger applet.
Overrides:
_init in class TimeDep

createEqn

public TimeDepSchrodinger createEqn()
Returns the model to be used for this applet.
Overrides:
createEqn in class TimeDep

addControls

protected void addControls()
Adds GUI components to this applet. Components required by the time-dependent Schrodinger applet but not required here will be created and initialised (to satisfy input validation requirements), but will be hidden from view.
Overrides:
addControls in class TimeDep

start

public void start()
Description copied from class: BaseApplet
Applets should use this method to perform any final initialisation necessary to "activate" the applet
Overrides:
start in class TimeDep

stop

public void stop()
Description copied from class: BaseApplet
When this method is called, the applet should cease any user interaction. In particular, any threads explicitly started should be stopped, any external resources should be closed. This method should negate the action of start().
Overrides:
stop in class TimeDep

updateInput

public void updateInput()
Reads in (and validates) input from the text fields.
Overrides:
updateInput in class TimeDep
Throws:
java.lang.IllegalArgumentException - if any input fields are invalid

advanceOnce

public void advanceOnce()
Performs one step of the simulation, and updates the graphs to reflect the changes.
Specified by:
advanceOnce in interface TimeDependent
Overrides:
advanceOnce in class TimeDep

getT

public double getT()
Returns the time elapsed in the model.
Specified by:
getT in interface TimeDependent
Overrides:
getT in class TimeDep

reset

protected boolean reset()
Stops any running animation, resets the model to the initial function, and clears the graphs.
Overrides:
reset in class TimeDep
Tags copied from class: TimeDep
Returns:
true if initialisation succeeded, false if there was an input validation error

doPaint

public void doPaint(java.awt.Graphics g)
Description copied from class: BaseApplet
Called by forcePaint() to actually perform the painting. Subclasses should implement this method as if it were the standard paint() method; buffering will then take place transparently.
Overrides:
doPaint in class TimeDep
Tags copied from class: BaseApplet
Parameters:
g - The Graphics object on which to paint

getObservedWidth

public double getObservedWidth()
Attempts to calculate the width of the (skewed) gaussian seen by the observer.
Returns:
The width of the gaussian, or zero if there is not enough data

setObsX

public void setObsX(double d)
Sets the observation point. The value of the function at this point will be plotted against time on the lower-right graph.