|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
edu.davidson.tools.SApplet
balance.Balance
public class Balance
This applet displays a pan balance. An active tare button is included, and the units of both the display and input values may be set by the user.
This applet uses Data Connections.
Applet Parameters
| NAME | Variable Type | Default | Description |
|---|---|---|---|
| BGColor | String | null | The string is converted to an integer representing the RGB color to be used as the background color for the applet. |
| BodyColor | String | #E0C000 | The string is converted to an integer representing the RGB color to be used for the body of the balance. |
| BodyHeight | int | 0 | The height in pixels of the body of the balance. If the value is zero, the applet will automatically set this value to fill the applet area. |
| BodyWidth | int | 0 | The width in pixels of the body of the balance. If the value is zero, the applet will automatically set this value to fill the applet area. |
| DisplayUnit | String | gram | Sets the unit used to display the mass on the balance. Options are gram, milligram, kilogram, ounce, and pound. |
| InputUnit | String | gram | Sets the unit for the mass as supplied by the user. Options are gram, milligram, kilogram, ounce, and pound. The applet automatically converts from the input to the display unit. |
| IsReady | String | JavaScript variable that will be set to true when applet has initialized. Must use MAYSCRIPT in APPLET tag to use this feature. | |
| Mass | double | 0.0 | Value of the mass in the input unit. |
| PanColor | String | #C0C0C0 | The string is converted to an integer representing the RGB color to be used for the pan. |
| PanWidth | int | 0 | Width in pixels of the pan. If the value is zero, the applet will automatically selected the width. |
| Precision | int | 2 | The number of decimal places to be displayed (0-4). |
| Scale | int | 2 | The maximum display value for the balance is 10 raised to this power. The default scale value of 2 corresponds with a maximum display value of 10^2 = 100. |
| StandardDeviation | double | 0.0 | Gaussian error with this standard deviation is added to the displayed value. |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.BaselineResizeBehavior |
| Field Summary |
|---|
| 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 | |
|---|---|
Balance()
|
|
| Method Summary | |
|---|---|
void |
addData(edu.davidson.tools.SDataSource ds,
int id,
double[] xVal,
double[] yVal)
Adds an array of data points via DataConnections. |
void |
addDatum(edu.davidson.tools.SDataSource ds,
int id,
double xVal,
double yVal)
The data source and id are not used. |
void |
clearSeries(int id)
This method is required by SDataListener but is not used in this class. |
void |
deleteSeries(int id)
This method is required by SDataListener but is not used in this class. |
void |
destroy()
|
java.lang.String |
getAppletInfo()
|
edu.davidson.tools.SApplet |
getOwner()
Gets the owner of this DataListener |
java.lang.String |
getParameter(java.lang.String key,
java.lang.String def)
|
java.lang.String[][] |
getParameterInfo()
|
void |
init()
|
void |
paint(java.awt.Graphics g)
|
void |
setMass(double _mass)
Sets the mass. |
void |
setOwner(edu.davidson.tools.SApplet owner)
Sets the owner for SDataListener |
void |
setScale(int _scale,
int _precision)
Sets the scale and precision of the balance |
void |
setStandardDeviation(double _stdev)
Sets the standard deviation for the mass value. |
void |
setUnits(java.lang.String _unitInput,
java.lang.String _unitDisplay)
Sets the units displayed on the balance. |
void |
start()
|
void |
stop()
|
void |
updateDisplay()
Updates the display |
| Methods inherited from class edu.davidson.tools.SApplet |
|---|
addDataListener, addDataSource, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, forward, getClockID, getClockTime, getDataConnectionFromDL, getDataConnectionFromDS, getDataFromDS, getDataListener, getDataListener, getDataSource, getDataSource, getID, getRunningID, getSourceData, getSourceVariables, isAutoRefresh, isClockRunning, makeDataConnection, pause, removeDataListener, removeDataSource, reset, reverse, setAutoRefresh, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setDefault, 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 |
| 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, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, 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, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.davidson.tools.SDataListener |
|---|
getID |
| Constructor Detail |
|---|
public Balance()
| Method Detail |
|---|
public java.lang.String getParameter(java.lang.String key,
java.lang.String def)
public void init()
init in class java.applet.Appletpublic void start()
start in class java.applet.Appletpublic void stop()
stop in class java.applet.Appletpublic void destroy()
destroy in class edu.davidson.tools.SAppletpublic java.lang.String getAppletInfo()
getAppletInfo in class java.applet.Appletpublic java.lang.String[][] getParameterInfo()
getParameterInfo in class java.applet.Applet
public void addData(edu.davidson.tools.SDataSource ds,
int id,
double[] xVal,
double[] yVal)
addData in interface edu.davidson.tools.SDataListenerds - the data source supplying the information (not used).id - the data identification (not used).xVal - not usedyVal - mass
public void addDatum(edu.davidson.tools.SDataSource ds,
int id,
double xVal,
double yVal)
addDatum in interface edu.davidson.tools.SDataListenerds - the data source supplying the information (not used).id - the data identification (not used).xVal - not usedyVal - masspublic void clearSeries(int id)
clearSeries in interface edu.davidson.tools.SDataListenerpublic void deleteSeries(int id)
deleteSeries in interface edu.davidson.tools.SDataListenerpublic edu.davidson.tools.SApplet getOwner()
getOwner in interface edu.davidson.tools.SDataListenerpublic void paint(java.awt.Graphics g)
paint in class java.awt.Containerpublic void setMass(double _mass)
setUnits(java.lang.String, java.lang.String)public void setOwner(edu.davidson.tools.SApplet owner)
setOwner in interface edu.davidson.tools.SDataListenerowner - the owner of this DataListener
public void setScale(int _scale,
int _precision)
_scale - maximum mass is 10^_scale_precision - number of decimal places displacedpublic void setStandardDeviation(double _stdev)
public void setUnits(java.lang.String _unitInput,
java.lang.String _unitDisplay)
_unitInput - unit for input mass values_unitDisplay - unit for mass displaypublic void updateDisplay()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||