IDataSink
, java.util.EventListener
, javax.swing.event.ChangeListener
DisplayTimer
public class DisplayTextBox extends Display implements IDataSink, javax.swing.event.ChangeListener
Modifier and Type | Class | Description |
---|---|---|
static class |
DisplayTextBox.LabelType |
Typed constant used to indicate the type of label to be used with the display.
|
Modifier and Type | Field | Description |
---|---|---|
protected javax.swing.JLabel |
jLabel |
Descriptive text label to be displayed with the value
|
protected javax.swing.JPanel |
panel |
Displayed panel that holds the label and value
(not yet used; meant to implement to make lightweight display)
|
protected Unit |
unit |
Physical units associated with the displayed value.
|
protected javax.swing.JTextField |
value |
Object for displaying the value as a text field
|
Constructor | Description |
---|---|
DisplayTextBox() |
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
format(double d,
int precision) |
Formats a double with a specified number of digits.
|
java.lang.String |
getLabel() |
Accessor method of the label describing the display.
|
Constants.CompassDirection |
getLabelPosition() |
|
DisplayTextBox.LabelType |
getLabelType() |
|
int |
getPrecision() |
Accessor method of the precision, which specifies the number of significant figures to be displayed.
|
Unit |
getUnit() |
Returns the physical units of the displayed value.
|
java.awt.Component |
graphic() |
Method of Simulation.GraphicElement interface.
|
boolean |
isIntegerDisplay() |
|
void |
putData(IData data) |
Sets the display text to reflect the desired value from the datasource.
|
void |
putDataInfo(IDataInfo dataInfo) |
Informs the DataSink of the type of Data it should expect to receive.
|
void |
setDefaultLabel(java.lang.String defaultLabel) |
Sets label to the given value if it was not previously set.
|
void |
setIntegerDisplay(boolean integerDisplay) |
|
void |
setLabel(java.lang.String s) |
Sets the value of a descriptive label using the given string.
|
void |
setLabelPosition(Constants.CompassDirection position) |
|
void |
setLabelType(DisplayTextBox.LabelType labelType) |
|
void |
setPrecision(int n) |
Accessor method of the precision, which specifies the number of significant figures to be displayed.
|
void |
setUnit(Unit u) |
Accessor method to set the physical units of the displayed value.
|
void |
stateChanged(javax.swing.event.ChangeEvent evt) |
calls doUpdate method.
|
addPropertyChangeListener, removePropertyChangeListener, toString
protected javax.swing.JLabel jLabel
protected javax.swing.JTextField value
protected javax.swing.JPanel panel
protected Unit unit
public void putDataInfo(IDataInfo dataInfo)
IDataSink
putDataInfo
in interface IDataSink
public void stateChanged(javax.swing.event.ChangeEvent evt)
stateChanged
in interface javax.swing.event.ChangeListener
public void setUnit(Unit u)
public Unit getUnit()
public java.awt.Component graphic()
Display
public boolean isIntegerDisplay()
public void setIntegerDisplay(boolean integerDisplay)
integerDisplay
- The integerDisplay to set.public int getPrecision()
public void setPrecision(int n)
public void setLabel(java.lang.String s)
public java.lang.String getLabel()
Display
public void setDefaultLabel(java.lang.String defaultLabel)
public void setLabelType(DisplayTextBox.LabelType labelType)
public DisplayTextBox.LabelType getLabelType()
public void setLabelPosition(Constants.CompassDirection position)
public Constants.CompassDirection getLabelPosition()
public void putData(IData data)
public static java.lang.String format(double d, int precision)
d
- the double to formatprecision
- the number of digits desired