public class DeviceButtonSingle extends Device
Device.ActionSet
Modifier and Type | Field | Description |
---|---|---|
protected javax.swing.JButton |
button |
|
protected IAction |
targetAction |
controller, unit
Constructor | Description |
---|---|
DeviceButtonSingle(Controller controller) |
Constructs button that is not connected to any action.
|
DeviceButtonSingle(Controller controller,
IAction action) |
Constructs a button connected to the given action.
|
Modifier and Type | Method | Description |
---|---|---|
IAction |
getAction() |
Returns the currently defined action associated with the button.
|
java.lang.String |
getLabel() |
|
java.awt.Component |
graphic() |
Returns the GUI element for display in the simulation.
|
static void |
main(java.lang.String[] args) |
Method to demonstrate and test the use of this class.
|
void |
press() |
Performs the button's action.
|
void |
setAction(IAction newAction) |
Defines the action to be performed when the button is pressed.
|
void |
setLabel(java.lang.String text) |
Sets the value of a descriptive label using the given string.
|
doAction, getController, getDimension, getPostAction, getPreAction, getUnit, setController, setPostAction, setPreAction, setUnit
protected javax.swing.JButton button
protected IAction targetAction
public DeviceButtonSingle(Controller controller)
controller
- public DeviceButtonSingle(Controller controller, IAction action)
public void press()
public IAction getAction()
public void setAction(IAction newAction)
public java.awt.Component graphic()
public void setLabel(java.lang.String text)
public java.lang.String getLabel()
public static void main(java.lang.String[] args)