TextCursorpublic class TextCursor extends Object Class that represents the character index, and (x,y) position
of a text cursor in a TextField |
Fields Summary |
---|
public int | xx, y coordinates | public int | y | public int | widthwidth, height | public int | height | public int | indexarray index | public int | optiondrawing options: can be one of the PAINT_* variables in Text.java | public boolean | visiblewhether or not this cursor is visible | public int | preferredXpreferred x location when traversing vertically | public int | yOffsetyOffset to modify paint by for calculating h value |
Constructors Summary |
---|
public TextCursor(int index)Construct a new text cursor with the given array index
this.index = index;
option = Text.PAINT_USE_CURSOR_INDEX;
visible = true;
| public TextCursor(TextCursor tc)Copy a TextCursor object
this(0);
if (tc != null) {
this.x = tc.x;
this.y = tc.y;
this.option = tc.option;
this.index = tc.index;
this.visible = tc.visible;
this.preferredX = tc.preferredX;
this.yOffset = tc.yOffset;
}
|
Methods Summary |
---|
public void | paint(javax.microedition.lcdui.Graphics g)Paint this cursor in the given graphics context
// Stroke should already be SOLID
g.setColor(TextFieldSkin.COLOR_FG);
g.fillRect(x, y - yOffset - height + 2,
TextFieldSkin.WIDTH_CARET, height - 3);
g.setColor(0); // back to default black
|
|