Skip to main content


com.sun.lwuit
Class TextField

java.lang.Object
  
extended by com.sun.lwuit.Component extended by com.sun.lwuit.TextArea extended by com.sun.lwuit.TextField
All Implemented Interfaces:
Animation, StyleListener

public class TextField
extends TextArea

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 keymapping 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 declated 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
 
Constructor Summary
TextField()
          Default constructor
TextField(int columns)
          Construct a text field with space reserved for columns
TextField(java.lang.String text)
          Construct text field
TextField(java.lang.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(java.lang.String name, java.util.Hashtable values, boolean firstUpcase)
          Adds a new inputmode 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.
 void clear()
          Cleares the text from the TextField
protected  void commitChange()
          Commit the changes made to the text field as a complete edit operation.
static TextArea create()
          Default factory method
static TextArea create(int columns)
          Construct text field/area depending on whether native in place editing is supported
static TextArea create(java.lang.String text)
          Construct text field/area depending on whether native in place editing is supported
static TextArea create(java.lang.String text, int columns)
          Construct text field/area depending on whether native in place editing is supported
protected  Container createSymbolTable()
          Creates a symbol table container used by the showSymbolDialog method.
protected  void deinitialize()
          Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy.
 void deleteChar()
          Performs a backspace operation
protected  void fireClicked()
          When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly.
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 char position
 int getCursorX()
          Returns the position of the cursor char position in the current line.
 int getCursorY()
          Returns the position of the cursor line position
static int getDefaultChangeInputModeKey()
          Key to change the input mode on the device
static java.lang.String[] getDefaultInputModeOrder()
          Returns the order in which input modes are toggled by default
static int getDefaultSymbolDialogKey()
          The default key for poping open the symbol dialog
 java.lang.String getInputMode()
          Returns the currently selected input mode
 java.lang.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  java.lang.String getLongClickInputMode()
          Returns the input mode for the ong click mode
static char[] getSymbolTable()
          Returns the symbol table for the device
 void insertChars(java.lang.String c)
          This method is responsible for adding a character into the field and is the focal point for all input.
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 isEnableInputScroll()
          Indicates whether text field input should scroll to the right side when no more room for the input is present.
protected  boolean isImmediateInputMode(java.lang.String mode)
          Returns true if the given input mode should commit immediately or wait for the commit timeout
 boolean isLeftAndRightEditingTrigger()
          Indicates whether the left/right keys will trigger editing, this is true by default.
 boolean isOverwriteMode()
          Indicates that this is the overwrite mode
 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 isSelectableInteraction()
          This method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device.
protected  boolean isSymbolDialogKey(int keyCode)
          Returns true if this keycode is the one mapping to the symbol dialog popup
static boolean isUseNativeTextInput()
          Indicates that native text input should be used in text field when in place editing is supported by the platform
 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 keyRepeated(int keyCode)
          If this Component is focused, the key repeat event will call this method.
protected  void longKeyPress(int keyCode)
          If this Component is focused this method is invoked when the user presses and holds the key
 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
 void setAlignment(int align)
          Sets the Alignment of the TextArea to one of: CENTER, LEFT, RIGHT
static void setClearText(java.lang.String text)
          Set the text that should appear on the clear softkey
 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)
          Sets the position of the cursor char position
static void setDefaultChangeInputModeKey(int k)
          Key to change the input mode on the device
static void setDefaultInputModeOrder(java.lang.String[] order)
          Sets the order in which input modes are toggled by default and allows disabling/hiding an input mode
static void setDefaultSymbolDialogKey(int d)
          The default key for poping open the symbol dialog
 void setEditable(boolean b)
          Sets this text area to be editable or readonly
 void setEnableInputScroll(boolean enableInputScroll)
          Indicates whether text field input should scroll to the right side when no more room for the input is present.
 void setInputMode(java.lang.String inputMode)
          Sets the current selected input mode matching one of the existing input modes
 void setInputModeOrder(java.lang.String[] order)
          Sets the order in which input modes are toggled and allows disabling/hiding an input mode
 void setLeftAndRightEditingTrigger(boolean leftAndRightEditingTrigger)
          Indicates whether the left/right keys will trigger editing, this is true by default.
 void setOverwriteMode(boolean overwriteMode)
          Indicates that this is the overwrite 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)
          True is this is a qwerty device or a device that is currently 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(java.lang.String text)
          Set the text that should appear on the T9 softkey
 void setText(java.lang.String text)
          Sets the text within this text area
static void setUseNativeTextInput(boolean aUseNativeTextInput)
          Indicates that native text input should be used in text field when in place editing is supported by the platform
 void setUseSoftkeys(boolean useSoftkeys)
          When set to true softkeys are used to enable delete functionality
protected  void showSymbolDialog()
          Invoked to show the symbol dialog, this method can be overriden by subclasses to manipulate the symbol table
 boolean validChar(java.lang.String c)
          Checks if the candidate input is valid for this TextField
 
Methods inherited from class com.sun.lwuit.TextArea
addActionListener, autoDetectWidestChar, calcScrollSize, getAbsoluteAlignment, getActualRows, getAlignment, getColumns, getConstraint, getDefaultValign, getHint, getHintIcon, getLines, getLinesToScroll, getMaxSize, getRows, getRowsGap, getText, getTextAt, getUnsupportedChars, getVerticalAlignment, getWidestChar, isAutoDegradeMaxSize, isEditable, isEnterKey, isGrowByContent, isScrollableY, isSingleLineTextArea, isUseStringWidth, pointerHover, pointerHoverReleased, preprocess, removeActionListener, setAutoDegradeMaxSize, setColumns, setConstraint, setDefaultMaxSize, setDefaultValign, setGrowByContent, setHint, setHint, setHintIcon, setLinesToScroll, setMaxSize, setRows, setRowsGap, setSingleLineTextArea, setUnsupportedChars, setUseStringWidth, setVerticalAlignment, setWidestChar, setWidth
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, contains, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, dragInitiated, drawDraggedImage, drop, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getDragImage, getGridPosX, getGridPosY, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getStyle, getTensileLength, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isAlwaysTensile, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isRTL, isScrollable, isScrollableX, isScrollVisible, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, laidOut, longPointerPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, paramString, pointerDragged, pointerDragged, pointerHoverPressed, pointerPressed, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setCellRenderer, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setVisible, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextField

public TextField()
Default constructor


TextField

public TextField(int columns)
Construct a text field with space reserved for columns

Parameters:
columns - - the number of columns

TextField

public TextField(java.lang.String text)
Construct text field

Parameters:
text - the text of the field

TextField

public TextField(java.lang.String text,
                 int columns)
Construct text field

Parameters:
text - the text of the field
columns - - the number of columns
Method Detail

isUseNativeTextInput

public static boolean isUseNativeTextInput()
Indicates that native text input should be used in text field when in place editing is supported by the platform

Returns:
the useNativeTextInput

setUseNativeTextInput

public static void setUseNativeTextInput(boolean aUseNativeTextInput)
Indicates that native text input should be used in text field when in place editing is supported by the platform

Parameters:
aUseNativeTextInput - the useNativeTextInput to set

setClearText

public static void setClearText(java.lang.String text)
Set the text that should appear on the clear softkey

Parameters:
text - localized text for the clear softbutton

setT9Text

public static void setT9Text(java.lang.String text)
Set the text that should appear on the T9 softkey

Parameters:
text - text for the T9 softbutton

isEnableInputScroll

public boolean isEnableInputScroll()
Description copied from class: TextArea
Indicates whether text field input should scroll to the right side when no more room for the input is present.

Overrides:
isEnableInputScroll in class TextArea
Returns:
true if scrolling is enabled

setEnableInputScroll

public void setEnableInputScroll(boolean enableInputScroll)
Indicates whether text field input should scroll to the right side when no more room for the input is present.

Parameters:
enableInputScroll - true to enable scrolling to the side

deleteChar

public void deleteChar()
Performs a backspace operation


create

public static TextArea create(java.lang.String text,
                              int columns)
Construct text field/area depending on whether native in place editing is supported

Parameters:
text - the text of the field
columns - - the number of columns
Returns:
a text field if native in place editing is unsupported and a text area if it is

create

public static TextArea create()
Default factory method

Returns:
a text field if native in place editing is unsupported and a text area if it is

create

public static TextArea create(int columns)
Construct text field/area depending on whether native in place editing is supported

Parameters:
columns - - the number of columns
Returns:
a text field if native in place editing is unsupported and a text area if it is

create

public static TextArea create(java.lang.String text)
Construct text field/area depending on whether native in place editing is supported

Parameters:
text - the text of the field
Returns:
a text field if native in place editing is unsupported and a text area if it is

commitChange

protected void commitChange()
Commit the changes made to the text field as a complete edit operation. This is used in a numeric keypad to allow the user to repeatedly press a number to change values.


isPendingCommit

public boolean isPendingCommit()
Description copied from class: TextArea
Returns true if the text field is waiting for a commit on editing

Overrides:
isPendingCommit in class TextArea
Returns:
true if a commit is pending

setCommitTimeout

public void setCommitTimeout(int commitTimeout)
The amount of time in milliseconds it will take for a change to get committed into the field.

Parameters:
commitTimeout - indicates the amount of time that should elapse for a commit to automatically occur

getCommitTimeout

public int getCommitTimeout()
The amount of time in milliseconds it will take for a change to get committed into the field.

Returns:
the time for a commit timeout

setInputMode

public void setInputMode(java.lang.String inputMode)
Sets the current selected input mode matching one of the existing input modes

Parameters:
inputMode - the display name of the input mode by default the following modes are supported: Abc, ABC, abc, 123

getInputMode

public java.lang.String getInputMode()
Description copied from class: TextArea
Returns the currently selected input mode

Overrides:
getInputMode in class TextArea
Returns:
the display name of the input mode by default the following modes are supported: Abc, ABC, abc, 123

isChangeInputMode

protected boolean isChangeInputMode(int keyCode)
Indicates whether the key changes the current input mode

Parameters:
keyCode - the code
Returns:
true for the hash (#) key code

addInputMode

public static void addInputMode(java.lang.String name,
                                java.util.Hashtable values,
                                boolean firstUpcase)
Adds a new inputmode hashtable with the given name and set of values

Parameters:
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 keycode
firstUpcase - indicates if this input mode in an input mode used for the special case where the first letter is an upper case letter

getInputModeOrder

public java.lang.String[] getInputModeOrder()
Description copied from class: TextArea
Returns the order in which input modes are toggled

Overrides:
getInputModeOrder in class TextArea
Returns:
the order of the input modes

setInputModeOrder

public void setInputModeOrder(java.lang.String[] order)
Sets the order in which input modes are toggled and allows disabling/hiding an input mode

Parameters:
order - the order for the input modes in this field

getDefaultInputModeOrder

public static java.lang.String[] getDefaultInputModeOrder()
Returns the order in which input modes are toggled by default

Returns:
the default order of the input mode

setDefaultInputModeOrder

public static void setDefaultInputModeOrder(java.lang.String[] order)
Sets the order in which input modes are toggled by default and allows disabling/hiding an input mode

Parameters:
order - the order for the input modes in all future created fields

getLongClickInputMode

protected java.lang.String getLongClickInputMode()
Returns the input mode for the ong click mode

Returns:
returns 123 by default

getCharPerKeyCode

protected char getCharPerKeyCode(int pressCount,
                                 int keyCode,
                                 boolean longClick)
Returns the character matching the given key code after the given amount of user presses

Parameters:
pressCount - number of times this keycode was pressed
keyCode - the actual keycode input by the user
longClick - does this click constitute a long click
Returns:
the char mapping to this key or 0 if no appropriate char was found (navigation, input mode change etc...).

setCursorPosition

public void setCursorPosition(int pos)
Sets the position of the cursor char position

Parameters:
pos - the cursor position

getCursorPosition

public int getCursorPosition()
Description copied from class: TextArea
Returns the position of the cursor char position

Overrides:
getCursorPosition in class TextArea
Returns:
the cursor position

getCursorY

public int getCursorY()
Description copied from class: TextArea
Returns the position of the cursor line position

Overrides:
getCursorY in class TextArea
Returns:
the cursor line position

getCursorX

public int getCursorX()
Description copied from class: TextArea
Returns the position of the cursor char position in the current line.

Overrides:
getCursorX in class TextArea
Returns:
the cursor char position in the current line

setText

public void setText(java.lang.String text)
Description copied from class: TextArea
Sets the text within this text area

Overrides:
setText in class TextArea
Parameters:
text - new value for the text area

clear

public void clear()
Cleares the text from the TextField


isClearKey

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

Parameters:
keyCode - the key code that might be the clear key
Returns:
true if this is the clear key.

longKeyPress

protected void longKeyPress(int keyCode)
Description copied from class: Component
If this Component is focused this method is invoked when the user presses and holds the key

Overrides:
longKeyPress in class Component
Parameters:
keyCode - the key code value to indicate a physical key.

isQwertyInput

public boolean isQwertyInput()
Description copied from class: TextArea
True is this is a qwerty device or a device that is currently in qwerty mode.

Overrides:
isQwertyInput in class TextArea
Returns:
currently defaults to false

setQwertyInput

public void setQwertyInput(boolean qwerty)
True is this is a qwerty device or a device that is currently in qwerty mode.

Parameters:
qwerty - the value of qwerty mode

isImmediateInputMode

protected boolean isImmediateInputMode(java.lang.String mode)
Returns true if the given input mode should commit immediately or wait for the commit timeout

Parameters:
mode - the input mode
Returns:
returns true for input mode 123 by default

insertChars

public void insertChars(java.lang.String c)
This method is responsible for adding a character into the field and is the focal point for all input. It can be overriden to prevent a particular char from insertion or provide a different behavior for char insertion. It is the responsibility of this method to shift the cursor and invoke setText...

This method accepts a string for the more elaborate cases such as multi-char input and paste.

Parameters:
c - character for insertion

validChar

public boolean validChar(java.lang.String c)
Checks if the candidate input is valid for this TextField

Parameters:
c - the String to insert
Returns:
true if the String is valid

showSymbolDialog

protected void showSymbolDialog()
Invoked to show the symbol dialog, this method can be overriden by subclasses to manipulate the symbol table


createSymbolTable

protected Container createSymbolTable()
Creates a symbol table container used by the showSymbolDialog method. This method is designed for subclases to override and customize.

Returns:
container for the symbol table.

keyReleased

public void keyReleased(int keyCode)
Description copied from class: Component
If this Component is focused, the key released event will call this method

Overrides:
keyReleased in class TextArea
Parameters:
keyCode - the key code value to indicate a physical key.

getLongClickDuration

protected int getLongClickDuration()
The amount of time considered as a "long click" causing the long click method to be invoked.

Returns:
currently defaults to 800

getSymbolTable

public static char[] getSymbolTable()
Returns the symbol table for the device

Returns:
the symbol table of the device for the symbol table input

setSymbolTable

public static void setSymbolTable(char[] table)
Sets the symbol table to show when the user clicks the symbol table key

Parameters:
table - the symbol table of the device for the symbol table input

isCursorPositionCycle

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.

Returns:
true by default

isSymbolDialogKey

protected boolean isSymbolDialogKey(int keyCode)
Returns true if this keycode is the one mapping to the symbol dialog popup

Parameters:
keyCode - the keycode to check
Returns:
true if this is the star symbol *

deinitialize

protected void deinitialize()
Description copied from class: Component
Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. This allows the component to deregister animators and cleanup after itself. This method is the opposite of the initComponent() method.

Overrides:
deinitialize in class Component

setEditable

public void setEditable(boolean b)
Description copied from class: TextArea
Sets this text area to be editable or readonly

Overrides:
setEditable in class TextArea
Parameters:
b - true is text are is editable; otherwise false

keyRepeated

public void keyRepeated(int keyCode)
Description copied from class: Component
If this Component is focused, the key repeat event will call this method.

Overrides:
keyRepeated in class Component
Parameters:
keyCode - the key code value to indicate a physical key.

keyPressed

public void keyPressed(int keyCode)
Description copied from class: Component
If this Component is focused, the key pressed event will call this method

Overrides:
keyPressed in class TextArea
Parameters:
keyCode - the key code value to indicate a physical key.

installCommands

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

Parameters:
clear - the clear command
t9 - the t9 command
Returns:
clear command already installed in the form if applicable, none if no clear command was installed before or not applicable.

isSelectableInteraction

protected boolean isSelectableInteraction()
Description copied from class: Component
This method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device.

Overrides:
isSelectableInteraction in class TextArea
Returns:
true if this is a selectable interaction

fireClicked

protected void fireClicked()
Description copied from class: Component
When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly. When overriding this method you should also override isSelectableInteraction to indicate that a command is placed appropriately on top of the fire key for 3 soft button phones.

Overrides:
fireClicked in class TextArea

removeCommands

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

Parameters:
clear - the clear command
t9 - the t9 command
originalClear - the command originally assigned as the clear command (or null if no command was assigned before)

isEditingTrigger

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. This method is only called when handles input is false.

Parameters:
keyCode - the keycode passed to the keyPressed method
Returns:
true if this key code should cause a switch to editing mode.

isEditingEndTrigger

protected boolean isEditingEndTrigger(int keyCode)
Indicates whether the given key code should be ignored or should trigger cause editing to end. By default the fire key, up or down will trigger the end of editing.

Parameters:
keyCode - the keycode passed to the keyPressed method
Returns:
true if this key code should cause a switch to editing mode.

paint

public void paint(Graphics g)
Description copied from class: Component
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.

Specified by:
paint in interface Animation
Overrides:
paint in class TextArea
Parameters:
g - the component graphics

calcPreferredSize

protected Dimension calcPreferredSize()
Description copied from class: Component
Calculates the preferred size based on component content. This method is invoked lazily by getPreferred size.

Overrides:
calcPreferredSize in class TextArea
Returns:
the calculated preferred size based on component content

setCursorBlinkTimeOn

public void setCursorBlinkTimeOn(int time)
The amount of time in milliseconds in which the cursor is visible

Parameters:
time - for the cursor to stay "on"

setCursorBlinkTimeOff

public void setCursorBlinkTimeOff(int time)
The amount of time in milliseconds in which the cursor is invisible

Parameters:
time - for the cursor to stay "off"

getCursorBlinkTimeOn

public int getCursorBlinkTimeOn()
The amount of time in milliseconds in which the cursor is visible

Returns:
time for the cursor to stay "on"

getCursorBlinkTimeOff

public int getCursorBlinkTimeOff()
The amount of time in milliseconds in which the cursor is invisible

Returns:
time for the cursor to stay "off"

animate

public boolean animate()
Description copied from interface: Animation
Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the Display class.

Specified by:
animate in interface Animation
Overrides:
animate in class Component
Returns:
true if a repaint is desired or false if no repaint is necessary

pointerReleased

public void pointerReleased(int x,
                            int y)
Description copied from class: Component
If this Component is focused, the pointer released event will call this method

Overrides:
pointerReleased in class TextArea
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

isUseSoftkeys

public boolean isUseSoftkeys()
When set to true softkeys are used to enable delete functionality

Returns:
true if softkeys should be used

setUseSoftkeys

public void setUseSoftkeys(boolean useSoftkeys)
When set to true softkeys are used to enable delete functionality

Parameters:
useSoftkeys - true if softkeys should be used

addDataChangeListener

public void addDataChangeListener(DataChangedListener d)
Adds a listener for data change events it will be invoked for every change made to the text field

Parameters:
d - the listener

removeDataChangeListener

public void removeDataChangeListener(DataChangedListener d)
Removes the listener for data change events

Parameters:
d - the listener

isReplaceMenu

public 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

Returns:
true if the menu should be replaced

setReplaceMenu

public 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

Parameters:
replaceMenu - true if the menu should be replaced

isReplaceMenuDefault

public 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

Returns:
true if the menu should be replaced

setReplaceMenuDefault

public 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

Parameters:
replaceMenu - true if the menu should be replaced

setQwertyAutoDetect

public static void setQwertyAutoDetect(boolean v)
Indicates whether the text field should try to auto detect qwerty and switch the qwerty device flag implicitly

Parameters:
v - true for qwerty auto detection

setQwertyDevice

public static void setQwertyDevice(boolean v)
The default value for the qwerty flag so it doesn't need setting for every text field individually.

Parameters:
v - true for qwerty device

isQwertyAutoDetect

public static boolean isQwertyAutoDetect()
Indicates whether the text field should try to auto detect qwerty and switch the qwerty device flag implicitly

Returns:
true for qwerty auto detection

isQwertyDevice

public static boolean isQwertyDevice()
The default value for the qwerty flag so it doesn't need setting for every text field individually.

Returns:
true for qwerty devices

setDefaultChangeInputModeKey

public static void setDefaultChangeInputModeKey(int k)
Key to change the input mode on the device

Parameters:
k - key to change the input mode

getDefaultChangeInputModeKey

public static int getDefaultChangeInputModeKey()
Key to change the input mode on the device

Returns:
key to change the input mode

setDefaultSymbolDialogKey

public static void setDefaultSymbolDialogKey(int d)
The default key for poping open the symbol dialog

Parameters:
d - new key value

getDefaultSymbolDialogKey

public static int getDefaultSymbolDialogKey()
The default key for poping open the symbol dialog

Returns:
the default key

setOverwriteMode

public void setOverwriteMode(boolean overwriteMode)
Indicates that this is the overwrite mode

Parameters:
overwriteMode - set to true if input with overwrite characters

isOverwriteMode

public boolean isOverwriteMode()
Indicates that this is the overwrite mode

Returns:
true if input with overwrite characters

setLeftAndRightEditingTrigger

public void setLeftAndRightEditingTrigger(boolean leftAndRightEditingTrigger)
Indicates whether the left/right keys will trigger editing, this is true by default. Left and right key edit trigger might be disabled for cases such as text field positioned horizontally one next to the other.

Parameters:
leftAndRightEditingTrigger - Indicates whether the left/right keys will trigger editing

isLeftAndRightEditingTrigger

public boolean isLeftAndRightEditingTrigger()
Indicates whether the left/right keys will trigger editing, this is true by default. Left and right key edit trigger might be disabled for cases such as text field positioned horizontally one next to the other.

Returns:
leftAndRightEditingTrigger Indicates whether the left/right keys will trigger editing

setAlignment

public void setAlignment(int align)
Description copied from class: TextArea
Sets the Alignment of the TextArea to one of: CENTER, LEFT, RIGHT

Overrides:
setAlignment in class TextArea
Parameters:
align - alignment value
See Also:
Component.CENTER, Component.LEFT, Component.RIGHT


Copyright 2011 Oracle Corporation. All rights reserved. Use is subject to license terms.
 
 
Close
loading
Please Confirm
Close