|
jMobileCore toolkit | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jmobilecore.ui.core.Component com.jmobilecore.ui.core.TextComponent com.jmobilecore.ui.core.TextArea
public class TextArea
A textArea
object is a text component
that allows for the editing of a single line of text.
Field Summary | |
---|---|
TextAreaComposer |
composer
Handles input of the number keys |
int |
rows
The number of rows in the TextArea . |
static int |
ROWS
Default height of component |
static byte |
SYMBOL_WRAPPING
By symbol wrapping style |
static byte |
WORD_WRAPPING
By words wrapping style |
Fields inherited from class com.jmobilecore.ui.core.TextComponent |
---|
ALL_SPEC_CHARS, BORDER_GAP, BORDER_WIDTH, C_ALL_SPEC_CHARS, C_ALPHA, C_ALPHA_NUMERIC, C_ANY, C_EMAIL, C_EMAIL_SPEC_CHARS, C_LOWER_CASE, C_NO_CHARS, C_NUMERIC, C_SPACE, C_UPPER_CASE, cHandler, CHAR_OPTIONS, charOptionCounter, constraint, CURSOR_DELAY, CURSOR_TYPE_LINE, CURSOR_TYPE_SYMBOL, editable, EMAIL_SPEC_CHARS, insertMode, KEY_OPTIONS, lastKeyCode, LC_CHARS, NUMERIC_CHARS, SPACE_CHARS, UC_CHARS, validChars |
Fields inherited from class com.jmobilecore.ui.core.Component |
---|
alignment, background, CENTER, focusable, focusedBackground, focusedForeground, font, foreground, height, isCompletelyVisible, isFocused, isVisible, LEFT, parentScreen, RIGHT, screenY, valid, width |
Constructor Summary | |
---|---|
TextArea()
Constructs a new text area with the empty string as text. |
|
TextArea(int nRows)
Constructs a new text area with the specified number of rows and the empty string as text. |
|
TextArea(int nRows,
int constr)
Constructs a new text area with the specified number of rows, the binary mask of constraints and the empty string as text. |
|
TextArea(java.lang.String text)
Constructs a new text area with the specified text. |
|
TextArea(java.lang.String text,
int nRows)
Constructs a new text area with the specified text, and with the specified number of rows |
|
TextArea(java.lang.String text,
int nRows,
int constr)
Constructs a new text area with the specified text, the specified number of rows and binary mask constraints |
Method Summary | |
---|---|
void |
append(java.lang.String str)
Appends the given text to the text area's current text. |
protected AbstractComposer |
getComposer()
Gets current input composer |
java.lang.String |
getText()
Returns the text that is presented by this text component. |
void |
insert(java.lang.String str,
int pos)
Inserts the specified text at the specified position in this text area. |
boolean |
keyPressed(int keyCode)
Responds to a key press. |
void |
paint(javax.microedition.lcdui.Graphics g)
Paints the component |
protected void |
paintCursor(javax.microedition.lcdui.Graphics g)
Paints the cursor for this component |
void |
setFont(javax.microedition.lcdui.Font font)
Sets the font of this component. |
protected void |
setHeight()
Calculates the height of the component. |
void |
setText(java.lang.String newText)
Sets the text that is presented by this text component to be the specified text. |
void |
setWrappingStyle(byte style)
Sets the component wrapping style |
Methods inherited from class com.jmobilecore.ui.core.TextComponent |
---|
addValidChars, destructor, getCaretPosition, getKeyOption, initCursor, isCharValid, preProcessKeyCode, processKeyCode, resetCursor, resetCursorHandler, setCaretPosition |
Methods inherited from class com.jmobilecore.ui.core.Component |
---|
getBackground, getFont, getForeground, getHeight, getWidth, invalidate, isFocusOwner, keyReleased, keyRepeated, paintBackground, pointerDragged, pointerPressed, pointerReleased, prepareForeground, releaseFocus, requestFocus |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public TextAreaComposer composer
public int rows
TextArea
.
This parameter will determine the text area's height.
public static final int ROWS
public static final byte SYMBOL_WRAPPING
public static final byte WORD_WRAPPING
Constructor Detail |
---|
public TextArea()
public TextArea(int nRows)
nRows
- the number of rowspublic TextArea(int nRows, int constr)
nRows
- the number of rowsconstr
- constraints binary maskpublic TextArea(java.lang.String text)
text
- the text to be displayed; if text is null, the empty string "" will be displayedpublic TextArea(java.lang.String text, int nRows)
text
- the text to be displayed; if text is null, the empty string "" will be displayednRows
- the number of rowspublic TextArea(java.lang.String text, int nRows, int constr)
text
- the text to be displayed; if text is null, the empty string "" will be displayednRows
- the number of rowsconstr
- constraints binary maskMethod Detail |
---|
public void append(java.lang.String str)
protected AbstractComposer getComposer()
getComposer
in class TextComponent
public java.lang.String getText()
public void insert(java.lang.String str, int pos)
public boolean keyPressed(int keyCode)
TextComponent.C_NUMERIC
only,
no timing interval is used, the number is immediately inserted into the
field (if there is room).
If the key is a number key and the constraint IS NOT ONLY TextComponent.C_NUMERIC
,
the timing interval begins so that
characters may be cycled through via repeated presses of the same key
within the timing interval.
Presses of the left and right sides of the 4-way navigation key move the
cursor one character left or right within the field. Pressing the *
key deletes the character to the left of the cursor. Pressing the #
key inserts a space at the cursor position.
You can override this method if you want a custom component to perform
additional filtering of key presses. For example, if you want a field that
accepts only odd digits you could extend this class, ensure it is
TextComponent.C_NUMERIC
, then in this method check that the pressed key is an odd
digit before passing it to the parent's keyPressed
method.
keyPressed
in class Component
keyCode
- The code for the key that was pressed.
true
if the key was successfully processed, false
otherwisepublic void paint(javax.microedition.lcdui.Graphics g)
paint
in class Component
g
- Graphics objectprotected void paintCursor(javax.microedition.lcdui.Graphics g)
g
- Graphics objectpublic void setFont(javax.microedition.lcdui.Font font)
setFont
in class Component
font
- the font to become this component's font;
if this parameter is null
then this
component font won't be changedprotected void setHeight()
setHeight
in class Component
public void setText(java.lang.String newText)
newText
- the new text.public void setWrappingStyle(byte style)
style
- indicates new wrapping styleWORD_WRAPPING
,
SYMBOL_WRAPPING
|
jMobileCore toolkit | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |