public class TextField
ImplementsActionSource, Animation, Editable, StyleListener, TextHolder
Known subtypesAutoCompleteTextField
A specialized version of com.codename1.ui.TextArea with some minor deviations from the original
specifically:
Blinking cursor is rendered on
TextFieldonlycom.codename1.ui.events.DataChangeListeneris only available inTextField. This is crucial for character by character input event trackingcom.codename1.ui.TextField#setDoneListener(com.codename1.ui.events.ActionListener)is only available inTextFieldDifferent UIID’s ("
TextField" vs. “TextArea”)
The demo code below shows simple input using text fields:
TableLayout tl;
int spanButton = 2;
if(Display.getInstance().isTablet()) {
tl = new TableLayout(7, 2);
} else {
tl = new TableLayout(14, 1);
spanButton = 1;
}
tl.setGrowHorizontally(true);
hi.setLayout(tl);
TextField firstName = new TextField("", "First Name", 20, TextArea.ANY);
TextField surname = new TextField("", "Surname", 20, TextArea.ANY);
TextField email = new TextField("", "E-Mail", 20, TextArea.EMAILADDR);
TextField url = new TextField("", "URL", 20, TextArea.URL);
TextField phone = new TextField("", "Phone", 20, TextArea.PHONENUMBER);
TextField num1 = new TextField("", "1234", 4, TextArea.NUMERIC);
TextField num2 = new TextField("", "1234", 4, TextArea.NUMERIC);
TextField num3 = new TextField("", "1234", 4, TextArea.NUMERIC);
TextField num4 = new TextField("", "1234", 4, TextArea.NUMERIC);
Button submit = new Button("Submit");
TableLayout.Constraint cn = tl.createConstraint();
cn.setHorizontalSpan(spanButton);
cn.setHorizontalAlign(Component.RIGHT);
hi.add("First Name").add(firstName).
add("Surname").add(surname).
add("E-Mail").add(email).
add("URL").add(url).
add("Phone").add(phone).
add("Credit Card").
add(GridLayout.encloseIn(4, num1, num2, num3, num4)).
add(cn, submit);
The following code demonstrates a more advanced search widget where the data is narrowed as we type
directly into the title area search. Notice that the TextField and its hint are styled to look like the title.
Toolbar.setGlobalToolbar(true);
Form hi = new Form("Toolbar", BoxLayout.y());
Style s = UIManager.getInstance().getComponentStyle("Title");
TextField searchField = new TextField("", "Toolbar Search");
searchField.getHintLabel().setUIID("Title");
searchField.setUIID("Title");
searchField.getAllStyles().setAlignment(Component.LEFT);
hi.getToolbar().setTitleComponent(searchField);
FontImage searchIcon = FontImage.createMaterial(FontImage.MATERIAL_SEARCH, s);
hi.getToolbar().addCommandToRightBar("", searchIcon, e -> searchField.startEditingAsync());
hi.addAll(
new Label("A Game of Thrones"),
new Label("A Clash Of Kings"),
new Label("A Storm Of Swords"),
new Label("A Feast For Crows"),
new Label("A Dance With Dragons"));
searchField.addDataChangedListener((type, index) -> {
String text = searchField.getText().toLowerCase();
for (Component cmp : hi.getContentPane()) {
String value = ((Label) cmp).getText().toLowerCase();
boolean show = text.length() == 0 || value.indexOf(text) > -1;
cmp.setHidden(!show);
cmp.setVisible(show);
}
hi.getContentPane().animateLayout(250);
});
Constructors
public TextField() | Default constructor |
public TextField(int columns) | Construct a text field with space reserved for columns |
public TextField(String text) | Construct text field |
public TextField(String text, String hint) | Construct text field with a hint |
public TextField(String text, String hint, int columns, int constraint) | Construct text field with a hint, columns and constraint values |
public TextField(String text, int columns) | Construct text field |
Methods
public static boolean isUseNativeTextInput() | Deprecated Indicates that native text input should be used in text field when in place editing is supported by the platform |
public static void setUseNativeTextInput(boolean aUseNativeTextInput) | Deprecated Indicates that native text input should be used in text field when in place editing is supported by the platform |
public static void setClearText(String text) | Set the text that should appear on the clear softkey |
public static void setT9Text(String text) | Set the text that should appear on the T9 softkey |
public static TextArea create(String text, int columns) | Construct text field/area depending on whether native in place editing is supported |
public static TextArea create() | Default factory method |
public static TextArea create(int columns) | Construct text field/area depending on whether native in place editing is supported |
public static TextArea create(String text) | Construct text field/area depending on whether native in place editing is supported |
public static void addInputMode(String name, Hashtable values, boolean firstUpcase) | Deprecated Adds a new inputmode hashtable with the given name and set of values |
public static String[] getDefaultInputModeOrder() | Deprecated Returns the order in which input modes are toggled by default |
public static void setDefaultInputModeOrder(String[] order) | Deprecated Sets the order in which input modes are toggled by default and allows disabling/hiding an input mode |
public static char[] getSymbolTable() | Returns the symbol table for the device |
public static void setSymbolTable(char[] table) | Sets the symbol table to show when the user clicks the symbol table key |
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 |
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 |
public static boolean isQwertyAutoDetect() | Indicates whether the text field should try to auto detect qwerty and switch the qwerty device flag implicitly |
public static void setQwertyAutoDetect(boolean v) | Indicates whether the text field should try to auto detect qwerty and switch the qwerty device flag implicitly |
public static boolean isQwertyDevice() | The default value for the qwerty flag so it doesn’t need setting for every text field individually. |
public static void setQwertyDevice(boolean v) | The default value for the qwerty flag so it doesn’t need setting for every text field individually. |
public static int getDefaultChangeInputModeKey() | Deprecated Key to change the input mode on the device |
public static void setDefaultChangeInputModeKey(int k) | Deprecated Key to change the input mode on the device |
public static int getDefaultSymbolDialogKey() | The default key for poping open the symbol dialog |
public static void setDefaultSymbolDialogKey(int d) | The default key for poping open the symbol dialog |
public boolean isEnableInputScroll() | Indicates whether text field input should scroll to the right side when no more room for the input is present. |
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. |
public void deleteChar() | Performs a backspace operation |
protected void commitChange() | Commit the changes made to the text field as a complete edit operation. |
public boolean isPendingCommit() | Returns true if the text field is waiting for a commit on editing |
public int getCommitTimeout() | The amount of time in milliseconds it will take for a change to get committed into the field. |
public void setCommitTimeout(int commitTimeout) | The amount of time in milliseconds it will take for a change to get committed into the field. |
public String getInputMode() | Deprecated Returns the currently selected input mode |
public void setInputMode(String inputMode) | Deprecated Sets the current selected input mode matching one of the existing input modes |
protected boolean isChangeInputMode(int keyCode) | Deprecated Indicates whether the key changes the current input mode |
public String[] getInputModeOrder() | Returns the order in which input modes are toggled |
public void setInputModeOrder(String[] order) | Deprecated Sets the order in which input modes are toggled and allows disabling/hiding an input mode |
protected String getLongClickInputMode() | Returns the input mode for the ong click mode |
protected char getCharPerKeyCode(int pressCount, int keyCode, boolean longClick) | Returns the character matching the given key code after the given amount of user presses |
public int getCursorPosition() | Returns the position of the cursor char position |
public void setCursorPosition(int pos) | Sets the position of the cursor char position |
public int getCursorY() | Returns the position of the cursor line position |
public int getCursorX() | Returns the position of the cursor char position in the current line. |
public void setText(String text) | Sets the text within this text area |
public void clear() | Clears the text from the TextField |
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 void longKeyPress(int keyCode) | If this Component is focused this method is invoked when the user presses and holds the key |
public boolean isQwertyInput() | True is this is a qwerty device or a device that is currently in qwerty mode. |
public void setQwertyInput(boolean qwerty) | True is this is a qwerty device or a device that is currently in qwerty mode. |
protected boolean isImmediateInputMode(String mode) | Deprecated Returns true if the given input mode should commit immediately or wait for the commit timeout |
public void insertChars(String c) | Deprecated This method is responsible for adding a character into the field and is the focal point for all input. |
public boolean validChar(String c) | Checks if the candidate input is valid for this TextField |
protected void showSymbolDialog() | Invoked to show the symbol dialog, this method can be overriden by subclasses to manipulate the symbol table |
protected Container createSymbolTable() | Creates a symbol table container used by the showSymbolDialog method. |
public void keyReleased(int keyCode) | If this Component is focused, the key released event will call this method |
protected int getLongClickDuration() | The amount of time considered as a “long click” causing the long click method to be invoked. |
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 isSymbolDialogKey(int keyCode) | Returns true if this keycode is the one mapping to the symbol dialog popup |
protected void deinitialize() | Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. |
public void setEditable(boolean b) | Sets this text area to be editable or readonly |
public void keyRepeated(int keyCode) | If this Component is focused, the key repeat event will call this method. |
public void keyPressed(int keyCode) | If this Component is focused, the key pressed event will call this method |
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 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 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 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 |
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. |
protected boolean isEditingEndTrigger(int keyCode) | Indicates whether the given key code should be ignored or should trigger cause editing to end. |
public 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. |
protected Dimension calcPreferredSize() | Calculates the preferred size based on component content. |
public int getCursorBlinkTimeOn() | The amount of time in milliseconds in which the cursor is visible |
public void setCursorBlinkTimeOn(int time) | The amount of time in milliseconds in which the cursor is visible |
public int getCursorBlinkTimeOff() | The amount of time in milliseconds in which the cursor is invisible |
public void setCursorBlinkTimeOff(int time) | The amount of time in milliseconds in which the cursor is invisible |
public boolean animate() | Allows the animation to reduce “repaint” calls when it returns false. |
public void pointerReleased(int x, int y) | If this Component is focused, the pointer released event will call this method |
public boolean isUseSoftkeys() | When set to true softkeys are used to enable delete functionality |
public void setUseSoftkeys(boolean useSoftkeys) | When set to true softkeys are used to enable delete functionality |
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 |
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 |
public boolean isOverwriteMode() | Indicates that this is the overwrite mode |
public void setOverwriteMode(boolean overwriteMode) | Indicates that this is the overwrite mode |
public boolean isLeftAndRightEditingTrigger() | Indicates whether the left/right keys will trigger editing, this is true by default. |
public void setLeftAndRightEditingTrigger(boolean leftAndRightEditingTrigger) | Indicates whether the left/right keys will trigger editing, this is true by default. |
protected TextSelection.Spans calculateTextSelectionSpan(TextSelection sel) | Calculates the spans for the the given text selection. |
Inherited fields
From TextArea
ANY, EMAILADDR, NUMERIC, PHONENUMBER, URL, DECIMAL, PASSWORD, UNEDITABLE, SENSITIVE, NON_PREDICTIVE, INITIAL_CAPS_WORD, INITIAL_CAPS_SENTENCE, USERNAME, UPPERCASE, ONE_TIME_CODE
From Component
DEFAULT_CURSOR, CROSSHAIR_CURSOR, TEXT_CURSOR, WAIT_CURSOR, SW_RESIZE_CURSOR, SE_RESIZE_CURSOR, NW_RESIZE_CURSOR, NE_RESIZE_CURSOR, N_RESIZE_CURSOR, S_RESIZE_CURSOR, W_RESIZE_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, MOVE_CURSOR, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_Y, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_IMMEDIATELY_DRAG_XY, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_CENTER_OFFSET, BRB_OTHER, CENTER, TOP, LEFT, BOTTOM, RIGHT, BASELINE
Inherited methods
From TextArea
getDefaultValign, setDefaultValign, setDefaultMaxSize, isAutoDegradeMaxSize, setAutoDegradeMaxSize, getWidestChar, setWidestChar, autoDetectWidestChar, isUseStringWidth, setUseStringWidth, initComponent, initLaf, getConstraint, setConstraint, setWidth, getText, getAsInt, getAsLong, getAsDouble, isEditable, getPreferredTabIndex, getMaxSize, setMaxSize, isScrollableY, pointerHover, pointerHoverReleased, getColumns, setColumns, getActualRows, getRows, setRows, getLines, getTextAt, preprocess, getRowsGap, setRowsGap, calcScrollSize, addActionListener, removeActionListener, addCloseListener, removeCloseListener, isGrowByContent, setGrowByContent, getUnsupportedChars, setUnsupportedChars, getLinesToScroll, setLinesToScroll, isSingleLineTextArea, setSingleLineTextArea, getAlignment, setAlignment, getAbsoluteAlignment, isEnterKey, getHint, setHint, getHintIcon, setHintIcon, setHint, getHintLabel, getVerticalAlignment, setVerticalAlignment, getBindablePropertyNames, getBindablePropertyTypes, bindProperty, unbindProperty, getBoundPropertyValue, setBoundPropertyValue, getGrowLimit, setGrowLimit, isEndsWith3Points, setEndsWith3Points, registerAsInputDevice, startEditing, startEditingAsync, isEditing, stopEditing, stopEditing, getStyle, addDataChangedListener, removeDataChangedListener, addDataChangeListener, removeDataChangeListener, fireDataChanged, getDoneListener, setDoneListener, fireDoneEvent, fireDoneEvent, isActAsLabel, setActAsLabel, shouldRenderComponentSelection, isTextSelectionEnabled, setTextSelectionEnabled, getTextSelectionSupport
From Component
setSameSize, isSetCursorSupported, parsePreferredSize, getDefaultDragTransparency, setDefaultDragTransparency, getEditingDelegate, setEditingDelegate, getCursor, setCursor, showNativeOverlay, hideNativeOverlay, updateNativeOverlay, getNativeOverlay, getAllStyles, getSameWidth, setSameWidth, getSameHeight, setSameHeight, getUIManager, getX, setX, getOuterX, getInnerX, getY, setY, getOuterY, getInnerY, isVisible, setVisible, getClientProperty, stripMarginAndPadding, clearClientProperties, putClientProperty, getDirtyRegion, setDirtyRegion, isOpaque, setOpaque, getWidth, getOuterWidth, getInnerWidth, getHeight, setHeight, getOuterHeight, getInnerHeight, isDragRegion, getDragRegionStatus, getBaseline, getBaselineResizeBehavior, getPreferredSizeStr, setPreferredSizeStr, getPreferredSize, setPreferredSize, getScrollDimension, setScrollSize, getPreferredW, setPreferredW, getPreferredH, setPreferredH, getOuterPreferredH, getInnerPreferredH, getOuterPreferredW, getInnerPreferredW, setSize, getUIID, setUIID, setUIIDFinal, setUIID, getInlineAllStyles, setInlineAllStyles, getInlineSelectedStyles, setInlineSelectedStyles, getInlineUnselectedStyles, setInlineUnselectedStyles, getInlineDisabledStyles, setInlineDisabledStyles, getInlinePressedStyles, setInlinePressedStyles, remove, getParent, getOwner, setOwner, isOwnedBy, containsOrOwns, addFocusListener, removeFocusListener, addScrollListener, removeScrollListener, getSelectCommandText, setSelectCommandText, getLabelForComponent, setLabelForComponent, focusGained, focusLost, paintBackgrounds, paintShadows, getAbsoluteX, getAbsoluteY, isInClippingRegion, paintIntersectingComponentsAbove, paintScrollbars, paintScrollbarX, getScrollOpacity, getSelectedRect, paintScrollbarY, paintComponent, paintComponent, getBorder, getScrollable, paintBackground, isScrollable, isScrollableX, getScrollX, setScrollX, getScrollY, setScrollY, onScrollX, onScrollY, getDraggedx, getDraggedy, getBottomGap, getSideGap, contains, visibleBoundsContains, hasFixedPreferredSize, getBounds, getBounds, getVisibleBounds, getVisibleBounds, isFocusable, setFocusable, onSetFocusable, resetFocusable, getTabIndex, setTabIndex, setPreferredTabIndex, isTraversable, setTraversable, setShouldCalcPreferredSize, handlesInput, setHandlesInput, consumesRawTextInput, hasFocus, setFocus, getComponentForm, getTopLevelContainer, repaint, repaint, registerForAnimation, deregisterFromAnimation, getAnimationManager, getScrollAnimationSpeed, setScrollAnimationSpeed, isBlockLead, setBlockLead, isIgnorePointerEvents, setIgnorePointerEvents, isRippleEffect, setRippleEffect, getInlineStylesTheme, setInlineStylesTheme, isHideInLandscape, setHideInLandscape, createStyleAnimation, isSmoothScrolling, setSmoothScrolling, stopScrollMomentum, pointerHoverPressed, pinch, pinchReleased, pinch, rotation, isPinchBlocksDragAndDrop, setPinchBlocksDragAndDrop, pointerDragged, getDragImage, getDragTransparency, setDragTransparency, toImage, dragInitiated, drawDraggedImage, draggingOver, dragEnter, dragExit, drop, addPullToRefresh, setPullToRefresh, respondsToPointerEvents, pointerDragged, isStickyDrag, pointerPressed, isDragAndDropOperation, pointerPressed, pointerReleased, longPointerPress, setVerticalScrollBounds, setHorizontalScrollBounds, isVScrollThumbGrabbed, isHScrollThumbGrabbed, isVScrollThumbHover, isHScrollThumbHover, isTensileDragEnabled, setTensileDragEnabled, addDropListener, removeDropListener, addDragOverListener, removeDragOverListener, isNativeDragSource, setNativeDragSource, getNativeDragOperation, setNativeDragOperation, createNativeDragOperation, isNativeDropTarget, setNativeDropTarget, getAcceptedDropMimeTypes, setAcceptedDropMimeTypes, getAcceptedDropActions, setAcceptedDropActions, canAcceptNativeDrop, nativeDragEnter, nativeDragOver, nativeDragExit, nativeDrop, addNativeDropListener, removeNativeDropListener, addNativeDragOverListener, removeNativeDragOverListener, dragFinished, addDragFinishedListener, addStateChangeListener, removeStateChangeListener, addPointerPressedListener, addLongPressListener, addContextMenuListener, removeContextMenuListener, addMouseWheelListener, removeMouseWheelListener, addStylusListener, removeStylusListener, mouseWheel, paintRippleOverlay, removePointerPressedListener, removeLongPressListener, removeDragFinishedListener, addPointerReleasedListener, removePointerReleasedListener, addPointerDraggedListener, removePointerDraggedListener, getDragSpeed, getPressedStyle, setPressedStyle, initUnselectedStyle, initPressedStyle, initDisabledStyle, initSelectedStyle, getUnselectedStyle, setUnselectedStyle, getSelectedStyle, setSelectedStyle, getDisabledStyle, setDisabledStyle, installDefaultPainter, requestFocus, toString, paramString, refreshTheme, refreshTheme, refreshTheme, isDragActivated, getGridPosY, getGridPosX, scrollRectToVisible, scrollRectToVisible, paintBorder, paintBorderBackground, isCellRenderer, setCellRenderer, isScrollVisible, setScrollVisible, setIsScrollVisible, laidOut, isInitialized, setInitialized, styleChanged, getNextFocusDown, setNextFocusDown, getNextFocusUp, setNextFocusUp, getNextFocusLeft, setNextFocusLeft, getNextFocusRight, setNextFocusRight, isEnabled, setEnabled, getName, setName, initCustomStyle, deinitializeCustomStyle, isRTL, setRTL, isTactileTouch, isTactileTouch, setTactileTouch, getPropertyNames, getPropertyTypes, getPropertyTypeNames, getPropertyValue, setPropertyValue, paintLockRelease, paintLock, isSnapToGrid, setSnapToGrid, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, blocksSideSwipe, isFlatten, setFlatten, getTensileLength, setTensileLength, isGrabsPointerEvents, setGrabsPointerEvents, getScrollOpacityChangeSpeed, setScrollOpacityChangeSpeed, growShrink, isAlwaysTensile, setAlwaysTensile, isDraggable, setDraggable, isDropTarget, setDropTarget, isChildOf, isHideInPortrait, setHideInPortrait, cancelRepaints, getCloudBoundProperty, setCloudBoundProperty, getCloudDestinationProperty, setCloudDestinationProperty, getComponentState, setComponentState, setHidden, isHidden, setHidden, isHidden, announceForAccessibility, getAccessibilityText, setAccessibilityText, getSemantics, getAccessibilityNode, accessibilityChanged, accessibilityChanged, getTooltip, setTooltip
Constructor details
TextField
public TextField()TextField
public TextField(int columns)Parameters
columnsint- the number of columns
TextField
public TextField(String text)Parameters
textString- the text of the field
TextField
public TextField(String text, String hint)Parameters
textString- the text of the field
hintString- the hint string
TextField
public TextField(String text, String hint, int columns, int constraint)Parameters
textString- the text of the field
hintString- the hint string
columnsint- columns value
constraintint- the constraint value
TextField
public TextField(String text, int columns)Parameters
textString- the text of the field
columnsint- the number of columns
Method details
isUseNativeTextInput
public static boolean isUseNativeTextInput()Returns
setUseNativeTextInput
public static void setUseNativeTextInput(boolean aUseNativeTextInput)Parameters
aUseNativeTextInputboolean- the useNativeTextInput to set
setClearText
public static void setClearText(String text)Parameters
textString- localized text for the clear softbutton
setT9Text
public static void setT9Text(String text)Parameters
textString- text for the T9 softbutton
create
public static TextArea create(String text, int columns)Parameters
textString- the text of the field
columnsint- the number of columns
Returns
create
public static TextArea create()Returns
create
public static TextArea create(int columns)Parameters
columnsint- the number of columns
Returns
create
public static TextArea create(String text)Parameters
textString- the text of the field
Returns
addInputMode
public static void addInputMode(String name, Hashtable values, boolean firstUpcase)Parameters
nameString- a unique display name for the input mode e.g. ABC, 123 etc…
valuesHashtable- 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
firstUpcaseboolean- indicates if this input mode in an input mode used for the special case where the first letter is an upper case letter
getDefaultInputModeOrder
public static String[] getDefaultInputModeOrder()Returns
setDefaultInputModeOrder
public static void setDefaultInputModeOrder(String[] order)Parameters
orderString[]- the order for the input modes in all future created fields
getSymbolTable
public static char[] getSymbolTable()Returns
setSymbolTable
public static void setSymbolTable(char[] table)Parameters
tablechar[]- the symbol table of the device for the symbol table input
isReplaceMenuDefault
public static boolean isReplaceMenuDefault()Returns
setReplaceMenuDefault
public static void setReplaceMenuDefault(boolean replaceMenu)Parameters
replaceMenuboolean- true if the menu should be replaced
isQwertyAutoDetect
public static boolean isQwertyAutoDetect()Returns
setQwertyAutoDetect
public static void setQwertyAutoDetect(boolean v)Parameters
vboolean- true for qwerty auto detection
isQwertyDevice
public static boolean isQwertyDevice()Returns
setQwertyDevice
public static void setQwertyDevice(boolean v)Parameters
vboolean- true for qwerty device
getDefaultChangeInputModeKey
public static int getDefaultChangeInputModeKey()Returns
setDefaultChangeInputModeKey
public static void setDefaultChangeInputModeKey(int k)Parameters
kint- key to change the input mode
getDefaultSymbolDialogKey
public static int getDefaultSymbolDialogKey()Returns
setDefaultSymbolDialogKey
public static void setDefaultSymbolDialogKey(int d)Parameters
dint- new key value
isEnableInputScroll
public boolean isEnableInputScroll()Returns
setEnableInputScroll
public void setEnableInputScroll(boolean enableInputScroll)Parameters
enableInputScrollboolean- true to enable scrolling to the side
deleteChar
public void deleteChar()commitChange
protected void commitChange()isPendingCommit
public boolean isPendingCommit()Returns
getCommitTimeout
public int getCommitTimeout()Returns
setCommitTimeout
public void setCommitTimeout(int commitTimeout)Parameters
commitTimeoutint- indicates the amount of time that should elapse for a commit to automatically occur
getInputMode
public String getInputMode()Returns
setInputMode
public void setInputMode(String inputMode)Parameters
inputModeString- the display name of the input mode by default the following modes are supported: Abc, ABC, abc, 123
isChangeInputMode
protected boolean isChangeInputMode(int keyCode)Parameters
keyCodeint- the code
Returns
getInputModeOrder
public String[] getInputModeOrder()Returns
setInputModeOrder
public void setInputModeOrder(String[] order)Parameters
orderString[]- the order for the input modes in this field
getLongClickInputMode
protected String getLongClickInputMode()Returns
getCharPerKeyCode
protected char getCharPerKeyCode(int pressCount, int keyCode, boolean longClick)Parameters
pressCountint- number of times this keycode was pressed
keyCodeint- the actual keycode input by the user
longClickboolean- does this click constitute a long click
Returns
getCursorPosition
public int getCursorPosition()Returns
setCursorPosition
public void setCursorPosition(int pos)Parameters
posint- the cursor position
getCursorY
public int getCursorY()Returns
getCursorX
public int getCursorX()Returns
setText
public void setText(String text)Parameters
textString- new value for the text area
clear
public void clear()isClearKey
protected boolean isClearKey(int keyCode)Parameters
keyCodeint- the key code that might be the clear key
Returns
longKeyPress
protected void longKeyPress(int keyCode)Parameters
keyCodeint- the key code value to indicate a physical key.
isQwertyInput
public boolean isQwertyInput()Returns
setQwertyInput
public void setQwertyInput(boolean qwerty)Parameters
qwertyboolean- the value of qwerty mode
isImmediateInputMode
protected boolean isImmediateInputMode(String mode)Parameters
modeString- the input mode
Returns
insertChars
public void insertChars(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
cString- character for insertion
validChar
public boolean validChar(String c)Parameters
cString- the String to insert
Returns
showSymbolDialog
protected void showSymbolDialog()createSymbolTable
protected Container createSymbolTable()Returns
keyReleased
public void keyReleased(int keyCode)Parameters
keyCodeint- the key code value to indicate a physical key.
getLongClickDuration
protected int getLongClickDuration()Returns
isCursorPositionCycle
protected boolean isCursorPositionCycle()Returns
isSymbolDialogKey
protected boolean isSymbolDialogKey(int keyCode)Parameters
keyCodeint- the keycode to check
Returns
deinitialize
protected void deinitialize()setEditable
public void setEditable(boolean b)Parameters
bboolean- true is text are is editable; otherwise false
keyRepeated
public void keyRepeated(int keyCode)Parameters
keyCodeint- the key code value to indicate a physical key.
keyPressed
public void keyPressed(int keyCode)Parameters
keyCodeint- the key code value to indicate a physical key.
installCommands
protected Command installCommands(Command clear, Command t9)Parameters
clearCommand- the clear command
t9Command- the t9 command
Returns
isSelectableInteraction
protected boolean isSelectableInteraction()Returns
fireClicked
protected void fireClicked()removeCommands
protected void removeCommands(Command clear, Command t9, Command originalClear)Parameters
clearCommand- the clear command
t9Command- the t9 command
originalClearCommand- the command originally assigned as the clear command (or null if no command was assigned before)
isEditingTrigger
protected boolean isEditingTrigger(int keyCode)Parameters
keyCodeint- the keycode passed to the keyPressed method
Returns
isEditingEndTrigger
protected boolean isEditingEndTrigger(int keyCode)Parameters
keyCodeint- the keycode passed to the keyPressed method
Returns
paint
public void paint(Graphics g)Parameters
gGraphics- the component graphics
calcPreferredSize
protected Dimension calcPreferredSize()Returns
getCursorBlinkTimeOn
public int getCursorBlinkTimeOn()Returns
setCursorBlinkTimeOn
public void setCursorBlinkTimeOn(int time)Parameters
timeint- for the cursor to stay “on”
getCursorBlinkTimeOff
public int getCursorBlinkTimeOff()Returns
setCursorBlinkTimeOff
public void setCursorBlinkTimeOff(int time)Parameters
timeint- for the cursor to stay “off”
animate
public boolean animate()com.codename1.ui.Display class.Returns
pointerReleased
public void pointerReleased(int x, int y)Parameters
xint- the pointer x coordinate
yint- the pointer y coordinate
isUseSoftkeys
public boolean isUseSoftkeys()Returns
setUseSoftkeys
public void setUseSoftkeys(boolean useSoftkeys)Parameters
useSoftkeysboolean- true if softkeys should be used
isReplaceMenu
public boolean isReplaceMenu()Returns
setReplaceMenu
public void setReplaceMenu(boolean replaceMenu)Parameters
replaceMenuboolean- true if the menu should be replaced
isOverwriteMode
public boolean isOverwriteMode()Returns
setOverwriteMode
public void setOverwriteMode(boolean overwriteMode)Parameters
overwriteModeboolean- set to true if input with overwrite characters
isLeftAndRightEditingTrigger
public boolean isLeftAndRightEditingTrigger()Returns
setLeftAndRightEditingTrigger
public void setLeftAndRightEditingTrigger(boolean leftAndRightEditingTrigger)Parameters
leftAndRightEditingTriggerboolean- Indicates whether the left/right keys will trigger editing
calculateTextSelectionSpan
protected TextSelection.Spans calculateTextSelectionSpan(TextSelection sel)Parameters
selTextSelection- The TextSelection