|
Java DTV API 1.0 12-Dec-2008 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.lwuit.Component
com.sun.lwuit.TextArea
com.sun.lwuit.TextField
Allows in place editing using a lightweight API without necessarily moving to the external native text box. The main drawback in this approach is that editing can't support features such as T9 and might not have the same key mapping or behavior of the native text input.
Notice that due to limitations of text area and text field input modes in text area aren't properly supported since they won't work properly across devices. To limit input modes please use the setInputModeOrder method. All constants declared in TextArea are ignored with the exception of PASSWORD.
Field Summary |
Fields inherited from class com.sun.lwuit.TextArea |
ANY, DECIMAL, EMAILADDR, INITIAL_CAPS_SENTENCE, INITIAL_CAPS_WORD, NON_PREDICTIVE, NUMERIC, PASSWORD, PHONENUMBER, SENSITIVE, UNEDITABLE, URL |
Fields inherited from class com.sun.lwuit.Component |
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP |
Fields inherited from interface com.sun.dtv.ui.Animated |
ALTERNATING, LOOP, REPEATING |
Constructor Summary | |
TextField()
Default constructor. |
|
TextField(int columns)
Construct a text field with space reserved for columns. |
|
TextField(String text)
Construct text field. |
|
TextField(String text,
int columns)
Construct text field. |
Method Summary | |
void |
addDataChangeListener(DataChangedListener d)
Adds a listener for data change events it will be invoked for every change made to the text field. |
static void |
addInputMode(String name,
Hashtable values,
boolean firstUpcase)
Adds a new input mode hashtable with the given name and set of values. |
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false. |
protected Dimension |
calcPreferredSize()
Calculates the preferred size based on component content. |
protected void |
commitChange()
Commit the changes made to the text field as a complete edit operation. |
protected void |
deleteChar()
Performs a backspace operation. |
protected char |
getCharPerKeyCode(int pressCount,
int keyCode,
boolean longClick)
Returns the character matching the given key code after the given amount of user presses. |
int |
getCommitTimeout()
The amount of time in milliseconds it will take for a change to get committed into the field. |
int |
getCursorBlinkTimeOff()
The amount of time in milliseconds in which the cursor is invisible. |
int |
getCursorBlinkTimeOn()
The amount of time in milliseconds in which the cursor is visible. |
int |
getCursorPosition()
Returns the position of the cursor. |
static String[] |
getDefaultInputModeOrder()
Returns the order in which input modes are toggled by default. |
String |
getInputMode()
Returns the currently selected input mode. |
String[] |
getInputModeOrder()
Returns the order in which input modes are toggled. |
protected int |
getLongClickDuration()
The amount of time considered as a "long click" causing the long click method to be invoked. |
protected String |
getLongClickInputMode()
Returns the input mode for the ong click mode. |
static char[] |
getSymbolTable()
Returns the symbol table for the device. |
protected String |
getUIID()
|
protected void |
initComponent()
Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state. |
protected Command |
installCommands(Command clear,
Command t9)
Installs the clear and t9 commands onto the parent form, this method can be overriden to provide device specific placement for these commands. |
protected boolean |
isChangeInputMode(int keyCode)
Indicates whether the key changes the current input mode. |
protected boolean |
isClearKey(int keyCode)
Returns true if this is the clear key on the device, many devices don't contain a clear key and even in those that contain it this might be an issue. |
protected boolean |
isCursorPositionCycle()
Returns true if the cursor should cycle to the beginning of the text when the user navigates beyond the edge of the text and visa versa. |
protected boolean |
isEditingEndTrigger(int keyCode)
Indicates whether the given key code should be ignored or should trigger cause editing to end. |
protected boolean |
isEditingTrigger(int keyCode)
Indicates whether the given key code should be ignored or should trigger editing, by default fire or any numeric key should trigger editing implicitly. |
boolean |
isPendingCommit()
Returns true if the text field is waiting for a commit on editing. |
static boolean |
isQwertyAutoDetect()
Indicates whether the text field should try to auto detect qwerty and switch the qwerty device flag implicitly. |
static boolean |
isQwertyDevice()
The default value for the qwerty flag so it doesn't need setting for every text field individually. |
boolean |
isQwertyInput()
True is this is a qwerty device or a device that is currently in qwerty mode. |
boolean |
isReplaceMenu()
Indicates whether the menu of the form should be replaced with the T9/Clear commands for the duration of interactivity with the text field. |
static boolean |
isReplaceMenuDefault()
Indicates whether the menu of the form should be replaced with the T9/Clear commands for the duration of interactivity with the text field. |
protected boolean |
isSymbolDialogKey(int keyCode)
Returns true if this keycode is the one mapping to the symbol dialog popup. |
boolean |
isUseSoftkeys()
When set to true softkeys are used to enable delete functionality. |
void |
keyPressed(int keyCode)
If this Component is focused, the key pressed event will call this method. |
void |
keyReleased(int keyCode)
If this Component is focused, the key released event will call this method. |
void |
paint(Graphics g)
This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering. |
void |
pointerReleased(int x,
int y)
If this Component is focused, the pointer released event will call this method. |
protected void |
removeCommands(Command clear,
Command t9,
Command originalClear)
Removes the clear and t9 commands from the parent form, this method can be overriden to provide device specific placement for these commands. |
void |
removeDataChangeListener(DataChangedListener d)
Removes the listener for data change events. |
static void |
setClearText(String text)
Set the text that should appear on the clear soft key. |
void |
setCommitTimeout(int commitTimeout)
The amount of time in milliseconds it will take for a change to get committed into the field. |
void |
setCursorBlinkTimeOff(int time)
The amount of time in milliseconds in which the cursor is invisible. |
void |
setCursorBlinkTimeOn(int time)
The amount of time in milliseconds in which the cursor is visible. |
void |
setCursorPosition(int pos)
Set the position of the cursor. |
static void |
setDefaultInputModeOrder(String[] order)
Sets the order in which input modes are toggled by default and allows disabling/hiding an input mode. |
void |
setEditable(boolean b)
Sets this text area to be editable or readonly. |
void |
setInputMode(String mode)
Sets the current selected input mode matching one of the existing input modes. |
void |
setInputModeOrder(String[] order)
Sets the order in which input modes are toggled and allows disabling/hiding an input mode. |
static void |
setQwertyAutoDetect(boolean v)
Indicates whether the text field should try to auto detect qwerty and switch the qwerty device flag implicitly. |
static void |
setQwertyDevice(boolean v)
The default value for the qwerty flag so it doesn't need setting for every text field individually. |
void |
setQwertyInput(boolean qwerty)
Set this device to operate in or no longer operate in qwerty mode. |
void |
setReplaceMenu(boolean replaceMenu)
Indicates whether the menu of the form should be replaced with the T9/Clear commands for the duration of interactivity with the text field. |
static void |
setReplaceMenuDefault(boolean replaceMenu)
Indicates whether the menu of the form should be replaced with the T9/Clear commands for the duration of interactivity with the text field. |
static void |
setSymbolTable(char[] table)
Sets the symbol table to show when the user clicks the symbol table key. |
static void |
setT9Text(String text)
Set the text that should appear on the T9 soft key. |
void |
setText(String text)
Sets the text within this text area. |
void |
setUseSoftkeys(boolean useSoftkeys)
When set to true softkeys are used to enable delete functionality. |
Methods inherited from class com.sun.lwuit.TextArea |
addActionListener, fireClicked, getColumns, getConstraint, getLines, getMaxSize, getRows, getRowsGap, getText, getTextAt, getUnsupportedChars, isAutoDegradeMaxSize, isEditable, isGrowByContent, isScrollableY, isSelectableInteraction, paintScrollbarY, removeActionListener, setAutoDegradeMaxSize, setColumns, setConstraint, setDefaultMaxSize, setGrowByContent, setMaxSize, setRows, setRowsGap, setUnsupportedChars |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TextField()
public TextField(int columns)
columns
- number of columnspublic TextField(String text)
text
- content of textfieldpublic TextField(String text, int columns)
text
- content of text fieldcolumns
- number of columnsMethod Detail |
public static void setClearText(String text)
text
- the text for clear soft keypublic static void setT9Text(String text)
text
- the text for T9 soft keyprotected void deleteChar()
protected String getUIID()
getUIID
in class TextArea
protected void commitChange()
public boolean isPendingCommit()
public void setCommitTimeout(int commitTimeout)
commitTimeout
- indicates the amount of time that should elapse for a commit
to automatically occurgetCommitTimeout()
public int getCommitTimeout()
setCommitTimeout(int)
public void setInputMode(String mode)
mode
- the display name of the input mode by default the following modes
are supported: Abc, ABC, abc, 123getInputMode()
public String getInputMode()
setInputMode(java.lang.String)
protected boolean isChangeInputMode(int keyCode)
keyCode
- the key code to check against
public static void addInputMode(String name, Hashtable values, boolean firstUpcase)
name
- a unique display name for the input mode e.g. ABC, 123 etc...values
- The key for the hashtable is an Integer keyCode and the value
is a String containing the characters to toggle between for the given keycodefirstUpcase
- indicates if this input mode in an input mode used for the special
case where the first letter is an upper case letterpublic String[] getInputModeOrder()
setInputModeOrder(java.lang.String[])
public void setInputModeOrder(String[] order)
order
- the order for the input modes in this fieldgetInputModeOrder()
public static String[] getDefaultInputModeOrder()
setDefaultInputModeOrder(java.lang.String[])
public static void setDefaultInputModeOrder(String[] order)
order
- the order for the input modes in all future created fieldsgetDefaultInputModeOrder()
protected String getLongClickInputMode()
protected char getCharPerKeyCode(int pressCount, int keyCode, boolean longClick)
pressCount
- number of times this keycode was pressedkeyCode
- the actual keycode input by the userlongClick
- does this click constitute a long click
public void setCursorPosition(int pos)
pos
- the position of the cursorgetCursorPosition()
public int getCursorPosition()
setCursorPosition(int)
public void setText(String text)
TextArea
setText
in class TextArea
text
- new value for the text areaTextArea.getText()
protected boolean isClearKey(int keyCode)
keyCode
- the key code that might be the clear key
public boolean isQwertyInput()
public void setQwertyInput(boolean qwerty)
qwerty
- indicate whether device should be set to qwerty mode or notpublic void keyReleased(int keyCode)
Component
keyReleased
in class TextArea
protected int getLongClickDuration()
public static char[] getSymbolTable()
setSymbolTable(char[])
public static void setSymbolTable(char[] table)
table
- the symbol tablegetSymbolTable()
protected boolean isCursorPositionCycle()
protected boolean isSymbolDialogKey(int keyCode)
keyCode
- the keycode to check
public void setEditable(boolean b)
TextArea
setEditable
in class TextArea
b
- true is text are is editable; otherwise falsepublic void keyPressed(int keyCode)
Component
keyPressed
in class TextArea
protected Command installCommands(Command clear, Command t9)
clear
- the clear commandt9
- the t9 command
protected void removeCommands(Command clear, Command t9, Command originalClear)
clear
- the clear commandt9
- the t9 commandoriginalClear
- the command originally assigned as the clear command (or null if no command was assigned before)protected boolean isEditingTrigger(int keyCode)
keyCode
- the keycode passed to the keyPressed method
protected boolean isEditingEndTrigger(int keyCode)
keyCode
- the keycode passed to the keyPressed method
public void paint(Graphics g)
Component
paint
in interface Animated
paint
in class TextArea
protected Dimension calcPreferredSize()
Component
calcPreferredSize
in class TextArea
protected void initComponent()
Component
initComponent
in class Component
public void setCursorBlinkTimeOn(int time)
time
- time in milliseconds in which the cursor is visiblegetCursorBlinkTimeOn()
public void setCursorBlinkTimeOff(int time)
time
- time in milliseconds in which the cursor is invisiblegetCursorBlinkTimeOff()
public int getCursorBlinkTimeOn()
setCursorBlinkTimeOn(int)
public int getCursorBlinkTimeOff()
setCursorBlinkTimeOff(int)
public boolean animate()
Animated
animate
in interface Animated
animate
in class Component
public void pointerReleased(int x, int y)
Component
pointerReleased
in class TextArea
public boolean isUseSoftkeys()
public void setUseSoftkeys(boolean useSoftkeys)
useSoftkeys
- value indicating whether softkeys are used to enable
delete functionalitypublic void addDataChangeListener(DataChangedListener d)
d
- the DataChangedListenerremoveDataChangeListener(com.sun.lwuit.events.DataChangedListener)
public void removeDataChangeListener(DataChangedListener d)
d
- the DataChangedListeneraddDataChangeListener(com.sun.lwuit.events.DataChangedListener)
public boolean isReplaceMenu()
public void setReplaceMenu(boolean replaceMenu)
replaceMenu
- true if the menu of the form should be replaced with
the T9/Clear commands for the duration of interactivity with the text fieldpublic static boolean isReplaceMenuDefault()
isReplaceMenu()
,
setReplaceMenuDefault(boolean)
public static void setReplaceMenuDefault(boolean replaceMenu)
replaceMenu
- default value for isReplaceMenu() return valueisReplaceMenu()
,
isReplaceMenuDefault()
public static void setQwertyAutoDetect(boolean v)
v
- value indicating whether the text field should try to auto
detect qwerty and switch the qwerty device flag implicitlypublic static void setQwertyDevice(boolean v)
v
- default value for the qwerty flag so it doesn't need setting for every
text field individuallypublic static boolean isQwertyAutoDetect()
public static boolean isQwertyDevice()
|
Java DTV API 1.0 12-Dec-2008 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |