|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pulpcore.sprite.Sprite pulpcore.sprite.TextField
public class TextField
The TextField is a Sprite that behaves like a common UI text input
field. It handles selection, cut, copy, paste, keyboard traversal and mouse
input. By default, a TextField's cursor is Input.CURSOR_TEXT
.
Field Summary | |
---|---|
Color |
caretColor
The caret color. |
Color |
selectionColor
The highlight color to use when text is selected. |
Fields inherited from class pulpcore.sprite.Sprite |
---|
alpha, anchorX, anchorY, angle, CENTER, DEFAULT, EAST, enabled, height, NORTH, NORTH_EAST, NORTH_WEST, pixelSnapping, SOUTH, SOUTH_EAST, SOUTH_WEST, visible, WEST, width, x, y |
Constructor Summary | |
---|---|
TextField(CoreFont font,
CoreFont selectionFont,
String text,
double x,
double y)
|
|
TextField(CoreFont font,
CoreFont selectionFont,
String text,
double x,
double y,
double w,
double h)
If height < 0, the height is automatically set to fit the font height. |
|
TextField(CoreFont font,
CoreFont selectionFont,
String text,
int x,
int y)
|
|
TextField(CoreFont font,
CoreFont selectionFont,
String text,
int x,
int y,
int w,
int h)
If height < 0, the height is automatically set to fit the font height. |
|
TextField(double x,
double y,
double w,
double h)
If height < 0, the height is automatically set to fit the font height. |
|
TextField(int x,
int y,
int w,
int h)
If height < 0, the height is automatically set to fit the font height. |
|
TextField(String text,
double x,
double y)
|
|
TextField(String text,
double x,
double y,
double w,
double h)
If height < 0, the height is automatically set to fit the font height. |
|
TextField(String text,
int x,
int y)
|
|
TextField(String text,
int x,
int y,
int w,
int h)
If height < 0, the height is automatically set to fit the font height. |
Method Summary | |
---|---|
protected void |
drawSprite(CoreGraphics g)
Draws the sprite. |
int |
getCaretPosition()
|
int |
getMaxNumChars()
|
protected int |
getNaturalHeight()
Gets the fixed-point value of the Sprite's natural height. |
protected int |
getNaturalWidth()
Gets the fixed-point value of the Sprite's natural width. |
String |
getText()
|
boolean |
hasFocus()
|
boolean |
isPasswordMode()
|
void |
propertyChange(Property property)
On a property change this Sprite is marked as dirty. |
void |
selectAll()
|
void |
setCaretPosition(int position)
|
void |
setCaretPosition(int position,
boolean selectMode)
|
void |
setFocus(boolean hasFocus)
|
void |
setMaxNumChars(int maxNumChars)
|
void |
setPasswordMode(boolean passwordMode)
|
void |
setText(String text)
|
void |
update(int elapsedTime)
Updates all of this Sprite's properties. |
Methods inherited from class pulpcore.sprite.Sprite |
---|
bindLocationTo, bindSizeTo, clearCursor, clearDirtyRect, contains, draw, getBlendMode, getCursor, getDirtyRect, getFilter, getLocalX, getLocalY, getParent, getPixelLevelChecks, getRoot, getScene2D, getTag, getViewX, getViewX, getViewY, getViewY, intersects, isDirty, isEnabled, isEnabledAndVisible, isMouseDoubleClicked, isMouseDown, isMouseHover, isMouseOver, isMousePressed, isMouseReleased, isMouseTripleClicked, isMouseWheelRotated, isOpaque, isPick, isPickEnabledAndVisible, isTransparent, move, move, move, move, move, move, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, removeFromParent, scale, scale, scale, scale, scale, scale, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, setAnchor, setAnchor, setBlendMode, setCursor, setDirty, setFilter, setLocation, setLocation, setSize, setSize, setTag, translate, translate, updateDirtyRect |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final Color selectionColor
public final Color caretColor
Constructor Detail |
---|
public TextField(int x, int y, int w, int h)
public TextField(double x, double y, double w, double h)
public TextField(String text, int x, int y)
public TextField(String text, int x, int y, int w, int h)
public TextField(String text, double x, double y)
public TextField(String text, double x, double y, double w, double h)
public TextField(CoreFont font, CoreFont selectionFont, String text, int x, int y)
public TextField(CoreFont font, CoreFont selectionFont, String text, int x, int y, int w, int h)
public TextField(CoreFont font, CoreFont selectionFont, String text, double x, double y)
public TextField(CoreFont font, CoreFont selectionFont, String text, double x, double y, double w, double h)
Method Detail |
---|
protected int getNaturalWidth()
Sprite
ImageSprite
, the natural width is the
width of the image.
getNaturalWidth
in class Sprite
protected int getNaturalHeight()
Sprite
ImageSprite
, the natural height is the
height of the image.
getNaturalHeight
in class Sprite
public boolean isPasswordMode()
public void setPasswordMode(boolean passwordMode)
public String getText()
public void setText(String text)
public void setMaxNumChars(int maxNumChars)
public int getMaxNumChars()
public boolean hasFocus()
public void setFocus(boolean hasFocus)
public void setCaretPosition(int position)
public void setCaretPosition(int position, boolean selectMode)
public int getCaretPosition()
public void propertyChange(Property property)
Sprite
propertyChange
in interface PropertyListener
propertyChange
in class Sprite
property
- the property whose value has changed.public void update(int elapsedTime)
Sprite
update
in class Sprite
public void selectAll()
protected void drawSprite(CoreGraphics g)
Sprite
This method may be called multiple times for each dirty rectangle. The clip of the graphics context will be set to the current dirty rectangle.
When the contents of this sprite change (in another words, the graphic output of this method
will be different from the last time it is called), subclasses should call
setDirty(true)
.
Implementors should not save a reference to the graphics context as it can change between calls to this method.
drawSprite
in class Sprite
|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |