etomica.graphics
Class DeviceToggleButton
java.lang.Object
etomica.graphics.Device
etomica.graphics.DeviceButton
etomica.graphics.DeviceToggleButton
- All Implemented Interfaces:
- GraphicalElement, Dimensioned
public class DeviceToggleButton
- extends DeviceButton
Button that toggles a boolean value. This device can connect to any object
capable of switching between two states. The device operates through a
ModifierBoolean instance that must be connected to the state of the
controlled object. Action is performed through the controller if given at
construction or set afterwards.
| Methods inherited from class etomica.graphics.Device |
doAction, getController, getDimension, getPostAction, getPreAction, getUnit, graphic, setController, setPostAction, setPreAction, setUnit |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
toggleAction
protected ActionToggle toggleAction
DeviceToggleButton
public DeviceToggleButton(IController controller)
DeviceToggleButton
public DeviceToggleButton(IController controller,
ModifierBoolean modifier)
DeviceToggleButton
public DeviceToggleButton(IController controller,
ModifierBoolean modifier,
String trueText,
String falseText)
getEtomicaInfo
public static EtomicaInfo getEtomicaInfo()
setModifier
public void setModifier(ModifierBoolean modifier,
String trueText,
String falseText)
setState
public void setState(boolean b)
- Toggles the button to the given state. No action is performed if the
button is already in the given state.
getState
public boolean getState()
- Returns the current true/false state of the button.
setTrueLabel
public void setTrueLabel(String text)
- Specifies the button's label when the toggle is set to true.
getTrueLabel
public String getTrueLabel()
- Returns:
- the label displayed when the toggle is set to true.
setFalseLabel
public void setFalseLabel(String text)
- Specifies the button's label when the toggle is set to false.
getFalseLabel
public String getFalseLabel()
- Returns:
- the label displayed when the toggle is set to false.
main
public static void main(String[] args)
- Method to demonstrate and test the use of this class. Slider is used to
control the temperature of a hard-sphere MD simulation