public class ShapeTextField extends ShapeInputControl
ShapeControl.ValueType
Modifier and Type | Field and Description |
---|---|
java.lang.String |
value
The current text in the text field that can be accessed
in the overridden action() method.
|
TYPE_DOUBLE, TYPE_INT, TYPE_STRING
UNKNOWN_NAME
Constructor and Description |
---|
ShapeTextField(Presentable p,
boolean ispublic,
double x,
double y,
double width,
double height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
boolean enabled,
java.awt.Font font)
Creates a persistent text field control.
|
ShapeTextField(Presentable p,
boolean ispublic,
double x,
double y,
double width,
double height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
boolean enabled,
java.awt.Font font,
ShapeControl.ValueType valueType,
double min,
double max)
Creates a persistent text field control.
|
ShapeTextField(Presentable p,
boolean ispublic,
double x,
double y,
double width,
double height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
java.awt.Font font)
Deprecated.
may be removed in future releases
|
ShapeTextField(Presentable p,
boolean ispublic,
double x,
double y,
double width,
double height,
java.awt.Color backgroundColor,
java.awt.Color textColor,
java.awt.Font font,
ShapeControl.ValueType valueType,
double min,
double max)
Deprecated.
may be removed in future releases
|
Modifier and Type | Method and Description |
---|---|
void |
executeUserAction(java.lang.String value)
This method is internal and shouldn't be called by user.
|
double |
getDoubleValue()
Returns the current
double value of the text field. |
int |
getIntValue()
Returns the current
int value of the text field. |
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 |
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 true 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 |
setTextColor(java.awt.Color textColor)
Sets the text color of this text field.
|
postSVGShapeSpecificAttributes
action, clone, contains, executeAction, getHeight, getPresentable, getWidth, isEnabled, randomPointInside, restoreOwner, setEnabled, setHeight, setValueToDefault, setWidth
canHandleClick, findSVGElement, getDrawMode, getGroup, getLevel, getName, getRotation, getScaleX, getScaleY, getSVGId, getX, getY, isJava2DSwingPresentation, isPublic_xjal, isSVGPresentation, isVisible, onAggregatorVisibilityChanged, onClick, randomPointInside, removeSVGFromOwner, removeSVGImage, resetSVGState, setLevel, setPos, setPos, setPublic_xjal, setRotation, setScale, setScale, setScaleX, setScaleY, setVisible, setX, setY, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeInternal, postInitialize
@AnyLogicInternalAPI public java.lang.String value
getText()
to obtain the current text from
other places.@Deprecated public ShapeTextField(Presentable p, boolean ispublic, double x, double y, double width, double height, java.awt.Color backgroundColor, java.awt.Color textColor, java.awt.Font font)
public ShapeTextField(Presentable p, boolean ispublic, double x, double y, double width, double height, java.awt.Color backgroundColor, java.awt.Color textColor, boolean enabled, 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 colorenabled
- the initial enabled statefont
- the text font@Deprecated public ShapeTextField(Presentable p, boolean ispublic, double x, double y, double width, double height, java.awt.Color backgroundColor, java.awt.Color textColor, java.awt.Font font, ShapeControl.ValueType valueType, double min, double max)
public ShapeTextField(Presentable p, boolean ispublic, double x, double y, double width, double height, java.awt.Color backgroundColor, java.awt.Color textColor, boolean enabled, java.awt.Font font, ShapeControl.ValueType 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 colorenabled
- the initial enabled statefont
- the text fontvalueType
- the type of the value edited in the text field, supported types:
ShapeControl.TYPE_STRING
, ShapeControl.TYPE_DOUBLE
, ShapeControl.TYPE_INT
min
- the minimum value of the text field with numeric value-type:
ShapeControl.TYPE_DOUBLE
, ShapeControl.TYPE_INT
ShapeControl.TYPE_STRING
max
- the maximum value of the text field with numeric value-type:
ShapeControl.TYPE_DOUBLE
, ShapeControl.TYPE_INT
ShapeControl.TYPE_STRING
public void setBackgroundColor(java.awt.Color backgroundColor)
backgroundColor
- the desired background Color
public void setTextColor(java.awt.Color textColor)
textColor
- the desired text Color
public 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 textpublic void setText(java.lang.String text, boolean callAction)
callAction
parameter is true
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 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 fieldpublic 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 valuepublic void setRange(double min, double max, boolean callAction)
ShapeControl.TYPE_DOUBLE
, ShapeControl.TYPE_INT
.callAction
parameter is true
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 value, leaving both min and max with zeroes will result in unlimited rangemax
- the new maximum value, leaving both min and max with zeroes will result in unlimited rangecallAction
- 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
@AnyLogicInternalAPI public void executeUserAction(java.lang.String value)
SVGElement
executeUserAction
in interface SVGElement
executeUserAction
in class Shape
Copyright © AnyLogic North America, LLC. All Rights Reserved.