|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.engine.ModelManipulator
public class ModelManipulator
Creates sliders and buttons for the manipulation of models. ModelManipulator can be used by a modeler to create buttons, sliders and checkboxes that can alter the state of the model while its running. These buttons, sliders, and checkboxes are displayed in gui run of a model on the Custom Actions tab in the settings window.
SimModelImpl contains a protected ivar (modelManipulator) of this type that can be used by all models extending SimModelImpl. See Heat Bugs and Hypercycles demonstration simulations for examples of its use.
| Constructor Summary | |
|---|---|
ModelManipulator()
|
|
| Method Summary | |
|---|---|
void |
addButton(java.lang.String label,
java.awt.event.ActionListener listener)
Adds a button with the specified label and listener to this ModelManipulator. |
void |
addCheckBox(java.lang.String label,
CheckBoxListener listener,
boolean isSelected)
Adds a checkbox to this ModelManipulator with the specified label, CheckBoxListener, and whether the box should be selected initially. |
void |
addComponent(java.awt.Component comp)
Adds the specified Component to this ModelManipulation. |
void |
addSlider(java.lang.String label,
int min,
int max,
int tickInterval,
SliderListener listener)
Adds a slider with the specified label, min and max values, tick interval and SliderListener to this manipulator. |
javax.swing.JPanel |
getPanel()
Gets a JPanel with the sliders, buttons, and checkboxes defined in the add* methods laid out and ready for display. |
void |
init()
Initializes the manipulator by clearing any previously added sliders, buttons, or checkboxes. |
boolean |
isEnabled()
Is this ModelManipulator's sliders, buttons, and checkboxes enabled |
void |
setEnabled(boolean enabled)
Enables or disables all the sliders, buttons, and checkboxes associated with this ModelManipulator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ModelManipulator()
| Method Detail |
|---|
public void init()
public void addSlider(java.lang.String label,
int min,
int max,
int tickInterval,
SliderListener listener)
label - the label for this slidermin - the minimum value for this slidermax - the maximum value for this slidertickInterval - the interval at which to draw label ticks for
this slider.listener - a listener that listens for and responds to events
fired by this slider. The action that should occur when a user
moves the slider is defined in this listener.SliderListener
public void addButton(java.lang.String label,
java.awt.event.ActionListener listener)
label - the label displayed by the buttonlistener - the listener that listens for and responds to
clicks of the button.ActionListenerpublic void addComponent(java.awt.Component comp)
This Component could be, for example, a JPanel containing a JTextField and JButton such that whenever the button is clicked some data from the model is saved to a file named in the JTextField.
comp - the component to addd
public void addCheckBox(java.lang.String label,
CheckBoxListener listener,
boolean isSelected)
label - the label for this check boxlistener - the listener for this checkboxisSelected - if true the box will initially display as checked
other as not checked.public void setEnabled(boolean enabled)
enabled - if true all the sliders, buttons, and checkboxes
associated with this ModelManipulator with be enabled. If false, they
will be disabled.public boolean isEnabled()
public javax.swing.JPanel getPanel()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||