|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectetomica.graphics.Device
etomica.graphics.DeviceBox
public class DeviceBox
A simple device the permits editing of a single value via a textbox with an associated label.
| Nested Class Summary | |
|---|---|
static class |
DeviceBox.LabelType
Typed constant used to indicate the type of label to be used with the display. |
| Nested classes/interfaces inherited from class etomica.graphics.Device |
|---|
Device.ActionSet |
| Field Summary | |
|---|---|
protected JLabel |
label
Descriptive text label to be displayed with the value |
protected String |
labelString
|
protected ModifyAction |
modifyAction
Modifier connecting the slider to the property |
protected JPanel |
panel
Displayed panel that holds the label and value (not yet used; meant to implement to make lightweight display) |
protected int |
precision
Integer specifying the number of significant figures to be displayed. |
protected JTextField |
textField
Object for displaying the value as a text field |
| Fields inherited from class etomica.graphics.Device |
|---|
controller, unit |
| Constructor Summary | |
|---|---|
DeviceBox()
|
|
| Method Summary | |
|---|---|
void |
addValueChangedListener(DeviceBoxValueChangedListener dbListener)
Add an object to be notified when the DeviceBox value to changes |
void |
deviceBoxValueChanged(DeviceBoxValueChangedEvent ev)
|
void |
doUpdate()
Updates the display of the box with the current value given by the modifier. |
static EtomicaInfo |
getEtomicaInfo()
|
String |
getLabel()
|
Constants.CompassDirection |
getLabelPosition()
|
DeviceBox.LabelType |
getLabelType()
|
Modifier |
getModifier()
Accessor method for the modifier that receives the edit. |
int |
getPrecision()
Accessor method of the precision, which specifies the number of significant figures to be displayed. |
Color |
getTextBackground()
|
Component |
graphic(Object obj)
Interface for a Simulation element that would be used in a simulation graphical user interface (GUI) |
boolean |
isEditable()
|
boolean |
isInteger()
|
void |
removeAllValueChangedListeners()
Removes all objects that are listening for a value changed event. |
void |
removeValueChangedListener(DeviceBoxValueChangedListener dbListener)
Remove an object that is listening for the DeviceBox value to change |
void |
setBorderBackground(Color color)
|
void |
setEditable(boolean b)
|
void |
setInteger(boolean b)
Sets a flag indicating if the value should be displayed as an integer. |
void |
setLabel(String s)
Sets the value of a descriptive label using the given string. |
void |
setLabelPosition(Constants.CompassDirection position)
|
void |
setLabelType(DeviceBox.LabelType newLabelType)
Sets the label type to "border" or "string". |
void |
setModifier(Modifier m)
Specifies the modifier that receives the edit. |
void |
setPrecision(int n)
Accessor method of the precision, which specifies the number of significant figures to be displayed. |
void |
setTextBackground(Color color)
|
void |
setUnit(Unit u)
Accessor method to set the physical units of the displayed value. |
void |
stateChanged(ChangeEvent evt)
calls doUpdate method. |
| Methods inherited from class etomica.graphics.Device |
|---|
doAction, getController, getDimension, getPostAction, getPreAction, getUnit, graphic, setController, setPostAction, setPreAction |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected JLabel label
protected String labelString
protected JTextField textField
protected JPanel panel
protected ModifyAction modifyAction
protected int precision
| Constructor Detail |
|---|
public DeviceBox()
| Method Detail |
|---|
public static EtomicaInfo getEtomicaInfo()
public void stateChanged(ChangeEvent evt)
stateChanged in interface ChangeListenerpublic void doUpdate()
public void setEditable(boolean b)
public boolean isEditable()
public void setUnit(Unit u)
setUnit in interface DimensionedsetUnit in class Devicepublic Component graphic(Object obj)
GraphicalElement
graphic in interface GraphicalElementgraphic in class Deviceobj - An object that might be used to specify the graphic that the GraphicalElement is to return.
In most cases the GraphicalElement ignores this parameter, and it can be set to null.
Device,
Displaypublic int getPrecision()
public void setPrecision(int n)
public void setInteger(boolean b)
public boolean isInteger()
public void setModifier(Modifier m)
public Modifier getModifier()
public void setLabel(String s)
public String getLabel()
public void setLabelType(DeviceBox.LabelType newLabelType)
public DeviceBox.LabelType getLabelType()
public void setLabelPosition(Constants.CompassDirection position)
public void setTextBackground(Color color)
public Color getTextBackground()
public void setBorderBackground(Color color)
public Constants.CompassDirection getLabelPosition()
public void addValueChangedListener(DeviceBoxValueChangedListener dbListener)
public void removeValueChangedListener(DeviceBoxValueChangedListener dbListener)
public void removeAllValueChangedListeners()
public void deviceBoxValueChanged(DeviceBoxValueChangedEvent ev)
deviceBoxValueChanged in interface DeviceBoxValueChangedListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||