etomica.graphics
Class DeviceSelector
java.lang.Object
etomica.graphics.Device
etomica.graphics.DeviceSelector
- All Implemented Interfaces:
- GraphicalElement, Dimensioned
public class DeviceSelector
- extends Device
Generic Device that has a combo box. Selecting an item from the combo box
will invoke an action. Each item has its own action.
| 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 |
actionHash
protected final HashMap<String,IAction> actionHash
DeviceSelector
public DeviceSelector(IController controller)
getSelector
public JComboBox getSelector()
getLabel
public JLabel getLabel()
setLabel
public void setLabel(String newLabel)
addOption
public void addOption(String actionText,
IAction action)
removeOption
public void removeOption(String actionText)
setSelected
public void setSelected(int i)
- Sets the i-th item (counting from 0) in the list as the one currently selected.
Argument outside bounds will result in an exception.
graphic
public Component graphic(Object obj)
- Returns the GUI element for display in the simulation.
Consists of a combo box used for the selector.
- 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