|
||||||||||
| 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.ShapeTextField
public class ShapeTextField
TextField control. Embeds JTextField. User's text field. Calls presentable object's executeControlAction( id, index, text ); method on focus lost or Enter pressed.
| Field Summary | |
|---|---|
java.lang.String |
value
The current text in the text field 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 | |
|---|---|
ShapeTextField(Presentable p,
boolean ispublic,
int x,
int y,
int width,
int height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
java.awt.Font font)
Creates a persistent text field control. |
|
ShapeTextField(Presentable p,
boolean ispublic,
int x,
int y,
int width,
int height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
java.awt.Font font,
int valueType,
double min,
double max)
Creates a persistent text field control. |
|
| Method Summary | |
|---|---|
void |
action()
Executes the action associated with a non-persistent text field. |
void |
focusGained(java.awt.event.FocusEvent arg0)
|
void |
focusLost(java.awt.event.FocusEvent arg0)
|
double |
getDoubleValue()
Returns the current double value of the text field. |
int |
getIntValue()
Returns the current int value of the text field. |
javax.swing.JComponent |
getJComponent()
Returns the JTextField of this control. |
double |
getMax()
Returns the maximum value of the text field. |
double |
getMin()
Returns the minimum value of the text field. |
java.lang.String |
getText()
Returns the text of the text field. |
void |
keyPressed(java.awt.event.KeyEvent key)
|
void |
keyReleased(java.awt.event.KeyEvent arg0)
|
void |
keyTyped(java.awt.event.KeyEvent arg0)
|
void |
setBackgroundColor(java.awt.Color backgroundColor)
Sets the background color of this text field. |
void |
setRange(double min,
double max)
Sets the minimum and maximum values of the text field with numeric value-type: ShapeControl.TYPE_DOUBLE, ShapeControl.TYPE_INT. |
void |
setRange(double min,
double max,
boolean callAction)
Sets the minimum and maximum values of the text field with numeric value-type: ShapeControl.TYPE_DOUBLE, ShapeControl.TYPE_INT. |
void |
setText(double value)
Sets the numeric value of the text field with value type ShapeControl.TYPE_DOUBLE or ShapeControl.TYPE_INT. |
void |
setText(double value,
boolean callAction)
Sets the numeric value of the text field with value type ShapeControl.TYPE_DOUBLE or ShapeControl.TYPE_INT. |
void |
setText(java.lang.String text)
Sets the text of the text field Doesn't execute user action code If value-type is numeric and the given text isn't
a valid number, nothing will be changed, and if text is
a number but not within [min, max], it will be
corrected to min or max |
void |
setText(java.lang.String text,
boolean callAction)
Sets the text of the text field Executes user action code (if any exists) if callAction
parameter is trueIf value-type is numeric and the given text isn't
a valid number, nothing will be changed, and if text is
a number but not within [min, max], it will be
corrected to min or max |
void |
setTextColor(java.awt.Color textColor)
Sets the text color of this text field. |
void |
setValueToDefault()
Sets the text of a non-persistent text field to what was provided as the default one. |
void |
update()
Updates the specific properties of a text field that are to be updated on each frame: min/max. |
| Methods inherited from class com.xj.anylogic.engine.presentation.ShapeControl |
|---|
clone, contains, draw, getHeight, getPresentable, getWidth, isEnabled, onClickAt, restoreOwner, setEnabled, setHeight, setWidth |
| 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
getText() to obtain the current text from
other places.
| Constructor Detail |
|---|
public ShapeTextField(Presentable p,
boolean ispublic,
int x,
int y,
int width,
int height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
java.awt.Font font)
ShapeControl.TYPE_STRING
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 colortextColor - the text colorfont - the text font
public ShapeTextField(Presentable p,
boolean ispublic,
int x,
int y,
int width,
int height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
java.awt.Font font,
int valueType,
double min,
double max)
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 colortextColor - the text colorfont - the text fontvalueType - the type of the value edited in the text field, supported types:
ShapeControl.TYPE_STRING, ShapeControl.TYPE_DOUBLE, ShapeControl.TYPE_INTmin - the minimum value of the text field with numeric value-type:
ShapeControl.TYPE_DOUBLE, ShapeControl.TYPE_INTShapeControl.TYPE_STRINGmax - the maximum value of the text field with numeric value-type:
ShapeControl.TYPE_DOUBLE, ShapeControl.TYPE_INTShapeControl.TYPE_STRING| Method Detail |
|---|
public void action()
action in class ShapeControlpublic javax.swing.JComponent getJComponent()
getJComponent in class ShapeControlpublic void setBackgroundColor(java.awt.Color backgroundColor)
backgroundColor - the desired background Colorpublic void setTextColor(java.awt.Color textColor)
textColor - the desired text Colorpublic void setValueToDefault()
setValueToDefault in class ShapeControlpublic void setText(java.lang.String text)
text isn't
a valid number, nothing will be changed, and if text is
a number but not within [min, max], it will be
corrected to min or max
text - the new text
public void setText(java.lang.String text,
boolean callAction)
callAction
parameter is truetext isn't
a valid number, nothing will be changed, and if text is
a number but not within [min, max], it will be
corrected to min or max
text - the new textcallAction - if true user action code
(if any exists) will be executedpublic void setText(double value)
ShapeControl.TYPE_DOUBLE or ShapeControl.TYPE_INT.
value - the new value (double or int)
public void setText(double value,
boolean callAction)
ShapeControl.TYPE_DOUBLE or ShapeControl.TYPE_INT.callAction
parameter is true
value - the new value (double or int)callAction - if true user action code
(if any exists) will be executedpublic java.lang.String getText()
public int getIntValue()
int value of the text field.
int value of the text fieldpublic double getDoubleValue()
double value of the text field.
double value of the text field
public void setRange(double min,
double max)
ShapeControl.TYPE_DOUBLE, ShapeControl.TYPE_INT.ShapeControl.TYPE_INT),
the given [min, max] range may be automatically corrected to have
integer bounds (within the given double bounds)
min - the new minimum valuemax - the new maximum value
public void setRange(double min,
double max,
boolean callAction)
ShapeControl.TYPE_DOUBLE, ShapeControl.TYPE_INT.callAction parameter is trueShapeControl.TYPE_INT),
the given [min, max] range may be automatically corrected to have
integer bounds (within the given double bounds)
min - the new minimum valuemax - the new maximum valuecallAction - if true user action code
(if any exists) will be executed if current text field value changespublic double getMin()
ShapeControl.TYPE_DOUBLE or ShapeControl.TYPE_INT
public double getMax()
ShapeControl.TYPE_DOUBLE or ShapeControl.TYPE_INT
public void update()
update in class ShapeControlpublic void focusGained(java.awt.event.FocusEvent arg0)
focusGained in interface java.awt.event.FocusListenerpublic void focusLost(java.awt.event.FocusEvent arg0)
focusLost in interface java.awt.event.FocusListenerpublic void keyPressed(java.awt.event.KeyEvent key)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent arg0)
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent arg0)
keyTyped in interface java.awt.event.KeyListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||