|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.presentation.Shape
com.xj.anylogic.engine.presentation.ShapeControl
com.xj.anylogic.engine.presentation.ShapeListBox
public class ShapeListBox
List box control. Embeds a JList component in a JScrollPane.
This object is only available in the AnyLogic Professional
| Field Summary | |
|---|---|
java.lang.String |
value
The currently selected item of the list box (or first item of multiselection) that can be accessed in the overridden action() method. |
java.lang.String[] |
values
The currently selected items of the list box (in the multiple-selection mode) that can be accessed in the overridden action() method. |
| Fields inherited from class com.xj.anylogic.engine.presentation.ShapeControl |
|---|
TYPE_DOUBLE, TYPE_INT, TYPE_STRING |
| Fields inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
UNKNOWN_NAME |
| Constructor Summary | |
|---|---|
ShapeListBox(Presentable p,
boolean ispublic,
int x,
int y,
int width,
int height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
java.awt.Font font,
java.lang.String[] items,
boolean multipleSelectionMode)
Creates a persistent list box control. |
|
| Method Summary | |
|---|---|
void |
action()
Executes the action associated with a non-persistent list box. |
java.lang.String[] |
getItems()
Returns array of String items currently used in this list box Note that returned array is the same as has been passed to setItems(String[]),
and may be null. |
javax.swing.JComponent |
getJComponent()
Returns the embedded JScrollPane which has JList as viewport view. |
java.lang.String |
getValue()
Returns the currently selected text item if in single-selection mode or Returns the first selected text item if in multiple-selection mode Returns null if there is no selection |
java.lang.String[] |
getValues()
Returns an array of selected text items (for use in multiple-selection mode) Returns empty array if there is no selection |
void |
setItems(java.lang.String[] items)
Sets new items for this list box This method preserves current list box values if current values are contained in new items. |
void |
setItems(java.lang.String[] items,
boolean callAction)
Sets new items for this list box This method preserves current list box values if current values are contained in new items. |
void |
setValue(java.lang.String text)
Sets the selected text item of the list box. |
void |
setValue(java.lang.String text,
boolean callAction)
Sets the selected text item of the list box. |
void |
setValues(java.lang.String[] texts)
Sets the selected text items of the list box (in the multiple-selection mode) Clears list box selection if texts is null
or emptyDoesn't execute user action code |
void |
setValues(java.lang.String[] texts,
boolean callAction)
Sets the selected text items of the list box (in the multiple-selection mode) Clears list box selection if texts is null
or emptyExecutes user action code (if any exists) if callAction
parameter is true |
void |
setValueToDefault()
Sets the text of a non-persistent list box to what was provided as the default one. |
void |
valueChanged(javax.swing.event.ListSelectionEvent e)
ListSelectionListener implementation. |
| Methods inherited from class com.xj.anylogic.engine.presentation.ShapeControl |
|---|
clone, contains, draw, getHeight, getPresentable, getWidth, isEnabled, onClickAt, restoreOwner, setEnabled, setHeight, setWidth, update |
| Methods inherited from class com.xj.anylogic.engine.presentation.Shape |
|---|
canHandleClick, getGroup, getName, getRotation, getScaleX, getScaleY, getX, getY, isVisible, onClick, setPos, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.lang.String value
getValue() to obtain the currently selected item from
other places
public java.lang.String[] values
getValues() to obtain the currently selected items from
other places
| Constructor Detail |
|---|
public ShapeListBox(Presentable p,
boolean ispublic,
int x,
int y,
int width,
int height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
java.awt.Font font,
java.lang.String[] items,
boolean multipleSelectionMode)
p - the presentable object owning this controlispublic - if true, the control is visible on container's presentationx - the x coordinatey - the y coordinatewidth - the widthheight - the heightbackgroundColor - the background color
colortextColor - the text colorfont - the text fontitems - the array of text items of the list boxmultipleSelectionMode - if true this list box will support multiple
intervals selection, otherwise - only single item selection| Method Detail |
|---|
public void action()
action in class ShapeControlpublic javax.swing.JComponent getJComponent()
getJComponent in class ShapeControlpublic void setValueToDefault()
setValueToDefault in class ShapeControlpublic void setValue(java.lang.String text)
null
text - the new selected text item or null
public void setValue(java.lang.String text,
boolean callAction)
nullcallAction
parameter is true
text - the new selected text item or nullcallAction - if true user action code (if any exists) will
be executedpublic void setValues(java.lang.String[] texts)
texts is null
or empty
texts - the new selected text items or null
public void setValues(java.lang.String[] texts,
boolean callAction)
texts is null
or emptycallAction
parameter is true
texts - the new selected text items or nullcallAction - if true user action code (if any exists) will
be executedpublic java.lang.String getValue()
null if there is no selection
public java.lang.String[] getValues()
public java.lang.String[] getItems()
setItems(String[]),
and may be null.
public void setItems(java.lang.String[] items)
items.
items - the array of String items to be placed in this list box
public void setItems(java.lang.String[] items,
boolean callAction)
items.
items - the array of String items to be placed in this list boxcallAction - if true and selection changes, user action code
(if any exists) will be executedpublic void valueChanged(javax.swing.event.ListSelectionEvent e)
valueChanged in interface javax.swing.event.ListSelectionListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||