Class TimeDep

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

public class TimeDep
extends BaseApplet2
implements TimeDependent

Applet to animate the time-dependent Schrodinger equation

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  AnimThread anim
          The thread used for animation, or null if no animation is in progress.
protected  java.awt.Button animButton
           
protected static java.awt.Color AXES_COL
           
protected static int DEFAULT_NWELLS
           
protected static int DEFAULT_STEPS
           
protected  java.awt.TextField depthField
           
protected  double dt
          The step size for the time direction
protected  java.awt.TextField dtField
           
protected  double dx
          The step size for the x direction
protected  java.awt.TextField dxField
           
protected static java.awt.Color ENERGY_COL
           
protected  java.awt.TextField energyField
           
protected  TimeDepSchrodinger eqn
          The time-dependent schrodinger equation
protected  java.awt.TextField fnStartField
           
protected  java.awt.TextField fnWidthField
           
protected  MultipleWells function
          The potential function to use when in "wells mode"
protected  double intWidth
          The size of the x axis interval to solve across
protected  java.awt.TextField intWidthField
           
protected  java.awt.TextField nWellsField
           
protected  Plotter2 plotter
           
protected static java.awt.Color POT_COL
           
protected  Plotter2 potPlotter
           
protected  java.awt.Checkbox quadBox
           
protected  Quadratic quadFunction
          The potential function to use when in "quadratic mode"
protected  java.awt.Button resetButton
           
protected  java.awt.Button stepButton
           
protected  int steps
          The number of different x values to use in the model
protected static java.awt.Color WAVE_FN_COL
           
protected static java.awt.Color WELL_BOUNDS_COL
           
protected  java.awt.TextField 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
TimeDep()
           
 
Method Summary
 void _init()
          Performs initialisation specific to this applet
 void _paint(java.awt.Graphics g, int w, int h)
          Marks the potential function on the graph.
 void actionPerformed(java.awt.event.ActionEvent ae)
          Subclasses should at least provide an empty implementation of this method.
protected  void addControls()
          Adds the GUI controls to this applet
 void advanceOnce()
          Executes one time step of the model
protected  void animate()
          Reqests that the animation be started if it is stopped or paused, and paused if it has already started.
protected  TimeDepSchrodinger createEqn()
          Creates the model to be used to obtain solution data.
 void doPaint(java.awt.Graphics g)
          Called by forcePaint() to actually perform the painting.
 double getT()
          Returns the time in the model
 void init()
          Performs extra initialisation, including adding a panel to the bottom of the applet.
 void killAnimation()
          Requests the animation stop at the next convenient opportunity.
protected  boolean reset()
          Resets the model, causing the function data to be reset to a gaussian.
 void start()
          Applets should use this method to perform any final initialisation necessary to "activate" the applet
protected  void step()
          Executes one time step of the model, then refreshes the display.
 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.
protected  void validateInput(double energy, double depth, double width, double intWidth, int nWells, int nSteps, double fnW, double x0)
          Performs the validation for updateInput().
 
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

steps

protected int steps
The number of different x values to use in the model

energyField

protected java.awt.TextField energyField

depthField

protected java.awt.TextField depthField

widthField

protected java.awt.TextField widthField

intWidthField

protected java.awt.TextField intWidthField

nWellsField

protected java.awt.TextField nWellsField

dxField

protected java.awt.TextField dxField

dtField

protected java.awt.TextField dtField

fnWidthField

protected java.awt.TextField fnWidthField

fnStartField

protected java.awt.TextField fnStartField

quadBox

protected java.awt.Checkbox quadBox

resetButton

protected java.awt.Button resetButton

animButton

protected java.awt.Button animButton

stepButton

protected java.awt.Button stepButton

eqn

protected TimeDepSchrodinger eqn
The time-dependent schrodinger equation

anim

protected AnimThread anim
The thread used for animation, or null if no animation is in progress.

dt

protected double dt
The step size for the time direction

dx

protected double dx
The step size for the x direction

intWidth

protected double intWidth
The size of the x axis interval to solve across

plotter

protected Plotter2 plotter

potPlotter

protected Plotter2 potPlotter

function

protected MultipleWells function
The potential function to use when in "wells mode"

quadFunction

protected Quadratic quadFunction
The potential function to use when in "quadratic mode"

POT_COL

protected static java.awt.Color POT_COL

ENERGY_COL

protected static java.awt.Color ENERGY_COL

AXES_COL

protected static java.awt.Color AXES_COL

WAVE_FN_COL

protected static java.awt.Color WAVE_FN_COL

WELL_BOUNDS_COL

protected static java.awt.Color WELL_BOUNDS_COL

DEFAULT_STEPS

protected static int DEFAULT_STEPS

DEFAULT_NWELLS

protected static int DEFAULT_NWELLS
Constructor Detail

TimeDep

public TimeDep()
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 BaseApplet2

_init

public void _init()
Performs initialisation specific to this applet

addControls

protected void addControls()
Adds the GUI controls to this applet

createEqn

protected TimeDepSchrodinger createEqn()
Creates the model to be used to obtain solution data.

updateInput

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

validateInput

protected void validateInput(double energy,
                             double depth,
                             double width,
                             double intWidth,
                             int nWells,
                             int nSteps,
                             double fnW,
                             double x0)
Performs the validation for updateInput().

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 BaseApplet2

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 BaseApplet2

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Description copied from class: BaseApplet
Subclasses should at least provide an empty implementation of this method.
Overrides:
actionPerformed in class BaseApplet

animate

protected void animate()
Reqests that the animation be started if it is stopped or paused, and paused if it has already started. The label of the Start button will be changed to reflect the state of the animation.

killAnimation

public void killAnimation()
Requests the animation stop at the next convenient opportunity.

step

protected void step()
Executes one time step of the model, then refreshes the display.

reset

protected boolean reset()
Resets the model, causing the function data to be reset to a gaussian.
Returns:
true if initialisation succeeded, false if there was an input validation error

advanceOnce

public void advanceOnce()
Executes one time step of the model
Specified by:
advanceOnce in interface TimeDependent

getT

public double getT()
Returns the time in the model
Specified by:
getT in interface TimeDependent

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 BaseApplet
Tags copied from class: BaseApplet
Parameters:
g - The Graphics object on which to paint

_paint

public void _paint(java.awt.Graphics g,
                   int w,
                   int h)
Marks the potential function on the graph. If the function consists of square wells, then only discontinuity markers will be drawn. Otherwise, the potential function will be plotted behind the graph.
Parameters:
g - The Graphics surface on which to paint
w - The width (in pixels) of the available display area
h - The height (in pixels) of the available display area