spectrum
Class Spectrum

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

public class Spectrum
extends SApplet

SpectrumApplet.class inherits from SApplet which inherits from Applet. This is the main entry point for the applet SpectrumApplet. The two main components of the applet are the controlPanel and one instance of SpectrumPanel.class.

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
Spectrum()
           
 
Method Summary
 int addAbsorption(double lambda, double width, double intensity)
          Adds Absorption slit to SpectrumPanel
 int addAbsorptionBand(double lambda1, double lambda2, java.lang.String func)
          Adds Absorption band to SpectrumPanel
 int addAbsorptionLine(double lambda, double width, double intensity)
          Adds Gaussian Absorption line to SpectrumPanel
 void addBalmerSeries(int bn, int sn)
          Method adds line from Balmer series to displayed spectrum.
 void addBlackBody(int temp, double saturation)
           
 void addBrackettSeries(int bn, int sn)
          Method adds line from Brackett series to displayed spectrum.
 int addCaption(java.lang.String text)
          Method adds a caption or title to top center of spectrum panel
 int addEmission(double lambda, double width, double intensity)
          Adds Emission slit to SpectrumPanel
 int addEmissionBand(double lambda1, double lambda2, java.lang.String func)
          Adds Emission band to SpectrumPanel
 int addEmissionLine(double lambda, double width, double intensity)
          Adds Gaussian Emission line to SpectrumPanel
 void addLymanSeries(int bn, int sn)
          Method adds line from Lyman series to displayed spectrum.
 void addPaschenSeries(int bn, int sn)
          Method adds line from Paschen series to displayed spectrum.
 void autoScale()
          Method auto-scales the spectrum.
 void clearAllLines()
          Method clears all absorption and emission lines.
 void clearCaption(int id)
          Method clears caption or line corresponding to given hashcode id
 void clearLine(int id)
          Method clears line corresponding to given hashcode id
 java.lang.String getAppletInfo()
           
 double getEnergy(int id)
          Method retrieves the energy of a line relative to its ground state
 double getIntensity(int id)
          Method retrieves the intensity of a line with given hashcode id.
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
           
 java.lang.String[][] getParameterInfo()
           
 int getSpectrumID()
           
 double getWavelength(int id)
          Method retrieves the wavelength of a line with given hashcode id.
 double getWidth(int id)
          Method retrieves the width of a line with given hashcode id.
 void init()
           
 void runSpectrum()
          Method controls main action of spectrumPanel.
 void setAutoRefresh(boolean ar)
          Method should be called from script only.
 int setCaption(int id, java.lang.String str)
          Method add caption to a plotted spectral line
 void setDefault()
          Reset the clock to time=0.
 void setDisplayOffset(int id, int xoff, int yoff)
          Method changes offset of title text from default top-center position
 void setDopplerShift(double v, boolean ds)
           
 boolean setDragable(int id, boolean drag)
          Make the object with the given id dragable.
 void setFalseColor(boolean fc)
           
 void setGroundState(int id, double en)
          Method sets a particular line to the ground state level
 void setIntensity(int id, double inNew)
          Changes intensity of a particular line
 void setMessage(java.lang.String msg)
          Adds a message to small yellow box opposite coordinate display.
 void setOneShot(double min, double max, java.lang.String msg)
          Set the applet to run for a fixed inteval, stop, and display a message.
 void setRGB(int id, int r, int g, int b)
           
 void setScale(double lambda1, double lambda2)
           
 void setShowControls(boolean sc)
           
 void setTrueColor(boolean tc)
           
 void setWavelength(int id, double lamNew)
          Changes wavelength of a particular line
 void setWavelengthUnit(java.lang.String u)
          method sets unit of wavelength.
 void start()
           
 
Methods inherited from class edu.davidson.tools.SApplet
addDataListener, addDataSource, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, destroy, forward, getClockID, getClockTime, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, makeDataConnection, pause, removeDataListener, removeDataSource, reset, reverse, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setDt, setExternalClock, setFPS, setRunningID, setRunningID, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stepTimeBack, stepTimeForward, 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

Spectrum

public Spectrum()
Method Detail

addAbsorption

public int addAbsorption(double lambda,
                         double width,
                         double intensity)
Adds Absorption slit to SpectrumPanel
Parameters:
lambda - double wavelength of slit in nm
width - double width of slit in nm
intensity - double relative intensity of absorption (0 <= i <= 1)
Returns:
int Returns the hashcode id of the absorption line.

addAbsorptionBand

public int addAbsorptionBand(double lambda1,
                             double lambda2,
                             java.lang.String func)
Adds Absorption band to SpectrumPanel
Parameters:
lambda1 - double wavelength in nm of left bound
lambda1 - double wavelength in nm of right bound
func - String intensity function for band f(lambda)
Returns:
int Returns the hashcode id of the absorption line.

addAbsorptionLine

public int addAbsorptionLine(double lambda,
                             double width,
                             double intensity)
Adds Gaussian Absorption line to SpectrumPanel
Parameters:
lambda - double wavelength in nm of line
width - double width of line in nm
intensity - double relative intensity of absorption peak(0 <= i <= 1)
Returns:
int Returns the hashcode id of the absorption line.

addBalmerSeries

public void addBalmerSeries(int bn,
                            int sn)
Method adds line from Balmer series to displayed spectrum.
Parameters:
bn - int upper index of series
sn - int lower indes of series. sn >= 3.

addBlackBody

public void addBlackBody(int temp,
                         double saturation)

addBrackettSeries

public void addBrackettSeries(int bn,
                              int sn)
Method adds line from Brackett series to displayed spectrum.
Parameters:
bn - int upper index of series
sn - int lower indes of series. sn >= 5.

addCaption

public int addCaption(java.lang.String text)
Method adds a caption or title to top center of spectrum panel
Parameters:
text - String

addEmission

public int addEmission(double lambda,
                       double width,
                       double intensity)
Adds Emission slit to SpectrumPanel
Parameters:
lambda - double wavelength of slit in nm
width - double width of slit in nm
intensity - double relative intensity of emission (0 <= i <= 1)
Returns:
int Returns the hashcode id of the emission line.

addEmissionBand

public int addEmissionBand(double lambda1,
                           double lambda2,
                           java.lang.String func)
Adds Emission band to SpectrumPanel
Parameters:
lambda1 - double wavelength of left bound in nm
lambda1 - double wavelength of right bound in nm
func - String intensity function for band f(lambda)
Returns:
int Returns the hashcode id of the emission line.

addEmissionLine

public int addEmissionLine(double lambda,
                           double width,
                           double intensity)
Adds Gaussian Emission line to SpectrumPanel
Parameters:
lambda - double wavelength of line in nm
width - double width of line in nm
intensity - double relative intensity of emission peak(0 <= i <= 1)
Returns:
int Returns the hashcode id of the emission line.

addLymanSeries

public void addLymanSeries(int bn,
                           int sn)
Method adds line from Lyman series to displayed spectrum.
Parameters:
bn - int upper index of series
sn - int lower indes of series. sn >= 2.

addPaschenSeries

public void addPaschenSeries(int bn,
                             int sn)
Method adds line from Paschen series to displayed spectrum.
Parameters:
bn - int upper index of series
sn - int lower indes of series. sn >= 4.

autoScale

public void autoScale()
Method auto-scales the spectrum. Must be called each time spectrum should be auto scaled.

clearAllLines

public void clearAllLines()
Method clears all absorption and emission lines.

clearCaption

public void clearCaption(int id)
Method clears caption or line corresponding to given hashcode id
Parameters:
id - int hashcode id

clearLine

public void clearLine(int id)
Method clears line corresponding to given hashcode id
Parameters:
id - int hashcode id

getAppletInfo

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

getEnergy

public double getEnergy(int id)
Method retrieves the energy of a line relative to its ground state
Parameters:
id - int hashcode id# of line
Returns:
double energy in 1/nm or 1/cm

getIntensity

public double getIntensity(int id)
Method retrieves the intensity of a line with given hashcode id.
Parameters:
id - int hashcode id# of line
Returns:
double intensity

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

getSpectrumID

public int getSpectrumID()

getWavelength

public double getWavelength(int id)
Method retrieves the wavelength of a line with given hashcode id.
Parameters:
id - int hashcode id# of line
Returns:
double wavelength in nm or cm

getWidth

public double getWidth(int id)
Method retrieves the width of a line with given hashcode id.
Parameters:
id - int hashcode id# of line
Returns:
double width in nm or cm

init

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

runSpectrum

public void runSpectrum()
Method controls main action of spectrumPanel. Can be called and should be called from script after adding a set of absorption or emission lines.

setAutoRefresh

public void setAutoRefresh(boolean ar)
Method should be called from script only. When set "true," the spectrumPanel will refresh itself every time a line or band is added. When set "false," the repainting will be suppressed. If "false," then scripter must call runSpectrum() after series of scripted lines in order to repaint the spectrum. Setting autoRefresh back to "true" will not cause a repaint.
Overrides:
setAutoRefresh in class SApplet
Parameters:
ar - boolean

setCaption

public int setCaption(int id,
                      java.lang.String str)
Method add caption to a plotted spectral line
Parameters:
id - int hashcode id of line
str - String caption text

setDefault

public void setDefault()
Description copied from class: SApplet
Reset the clock to time=0.
Overrides:
setDefault in class SApplet

setDisplayOffset

public void setDisplayOffset(int id,
                             int xoff,
                             int yoff)
Method changes offset of title text from default top-center position
Parameters:
id - int id of title
xoff - int pixel offset in horizontal direction
yoff - int pixel offset in vertical direction

setDopplerShift

public void setDopplerShift(double v,
                            boolean ds)

setDragable

public boolean setDragable(int id,
                           boolean drag)
Make the object with the given id dragable.
Parameters:
id - The id of the object.
drag - boolean Dragable?

setFalseColor

public void setFalseColor(boolean fc)

setGroundState

public void setGroundState(int id,
                           double en)
Method sets a particular line to the ground state level
Parameters:
id - int hashcode id of line
en - double Energy value in 1/(wavelength units)

setIntensity

public void setIntensity(int id,
                         double inNew)
Changes intensity of a particular line
Parameters:
id - int hashcode id of line to be cahnged
inNew - double new intensity of line -1<=in<=+1

setMessage

public void setMessage(java.lang.String msg)
Adds a message to small yellow box opposite coordinate display.
Parameters:
msg - String

setOneShot

public void setOneShot(double min,
                       double max,
                       java.lang.String msg)
Set the applet to run for a fixed inteval, stop, and display a message.
Parameters:
min - The starting time value for the loop
max - The ending time for the loop.
msg - Message to display after the animation stops.
See Also:
SApplet.setTimeContinuous(), #setTimeInterval

setRGB

public void setRGB(int id,
                   int r,
                   int g,
                   int b)

setScale

public void setScale(double lambda1,
                     double lambda2)

setShowControls

public void setShowControls(boolean sc)

setTrueColor

public void setTrueColor(boolean tc)

setWavelength

public void setWavelength(int id,
                          double lamNew)
Changes wavelength of a particular line
Parameters:
id - int hashcode id of line to be cahnged
lamNew - double new wavelength of line in nm or cm

setWavelengthUnit

public void setWavelengthUnit(java.lang.String u)
method sets unit of wavelength. default is nm.
Parameters:
u - String nm or cm

start

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

Copyright Wolfgang Christian

Visit the Davidson CollegePhyslets Page