etomica.graphics
Class DeviceCheckBox

java.lang.Object
  extended by etomica.graphics.Device
      extended by etomica.graphics.DeviceCheckBox
All Implemented Interfaces:
GraphicalElement, Dimensioned

public class DeviceCheckBox
extends Device

Button that toggles a boolean value via a check box. 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class etomica.graphics.Device
Device.ActionSet
 
Field Summary
 
Fields inherited from class etomica.graphics.Device
controller, unit
 
Constructor Summary
DeviceCheckBox(ModifierBoolean modifier)
           
DeviceCheckBox(String label, ModifierBoolean modifier)
           
 
Method Summary
 JCheckBox getCheckBox()
           
static EtomicaInfo getEtomicaInfo()
           
 ModifierBoolean getModifier()
          Specifies the boolean modifier that is set between true and false by the button.
 boolean getState()
          Returns the currents true/false state of the button.
 Component graphic(Object obj)
          Returns the GUI box element for display in the simulation.
 void setModifier(ModifierBoolean newModifier)
          Returns the boolean modifier set by this button.
 void setState(boolean b)
          Sets the button to the given state.
 void toggle()
          Toggles the state of the button (true to false, false to true).
 
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
 

Constructor Detail

DeviceCheckBox

public DeviceCheckBox(ModifierBoolean modifier)

DeviceCheckBox

public DeviceCheckBox(String label,
                      ModifierBoolean modifier)
Method Detail

getEtomicaInfo

public static EtomicaInfo getEtomicaInfo()

setState

public void setState(boolean b)
Sets the button to the given state.


getState

public boolean getState()
Returns the currents true/false state of the button.


toggle

public void toggle()
Toggles the state of the button (true to false, false to true).


getModifier

public ModifierBoolean getModifier()
Specifies the boolean modifier that is set between true and false by the button.


setModifier

public void setModifier(ModifierBoolean newModifier)
Returns the boolean modifier set by this button.


graphic

public Component graphic(Object obj)
Returns the GUI box element for display in the simulation.

Specified by:
graphic in interface GraphicalElement
Specified by:
graphic in class Device
Parameters:
obj - 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.
Returns:
A Component that can be used in the GUI of a graphical simulation
See Also:
Device, Display

getCheckBox

public JCheckBox getCheckBox()
Returns:
a handle to the JCheckBox instance used by this device