TextBox
is a text editor that takes up
the whole main
pane, operating effectively in full screen mode. Contents are
automatically wrapped around from one row to the next.
Since Java Runtime 2.1 for Symbian, TextBox
is shown as pop-up TextBoxes
as default. On devices
that support Java Runtime 1.3 for S60 or newer, TextBoxes
can also be created as pop-up TextBoxes
.
A TextBox
can have input constraints, such
as PASSWORD
, which obscures the actual characters
that are being typed.
A TextBox
turns automatically active, when
it becomes the foreground Displayable
or when it resumes input
focus. TextBox
supports copy and paste functionality.
Figure: Example of a full screen TextBox
Source codes for the example:
Needed JAD attribute for fullscreen TextBox
Nokia-UI-Enhancement: FullScreenTextBox
MIDlet source code
import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class ExampleTextbox extends MIDlet { Display display = Display.getDisplay(this); public void startApp() // TextBox(title, text, size, contrains) TextBox textbox = new TextBox("TextBox Example", "This is an example of a TextBox.\n" +"It has several lines of text.\n" +"\n" +"Lines that do not fit on the screen will be divided into two or more lines.", 255, 0); display.setCurrent(textbox); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } }
TextBox
and TextField
with input constraint TextField.ANY
support
input of the set of characters as specified by item 42 in the Change
Log Section on Page 9 of the JSR 118
specifications.
TextBox
and TextField
have an upper limit on the maximum number of characters that can
be stored in them. For the Series 40 platform this is set to 5000
characters.
Additional operations such as text selecting, text copying and pasting are not available in Series 40.
The support for a full keyboard in TextBox
es works in the same way as that of text input in native editors.
Note, however, that some of the text constraints are meaningless
in full keyboard editors:
Full keyboard editors do not always have automatic casing functionality
so, for example, INITIAL_CAPS_WORD
and INITIAL_CAPS_SENTENCE
are ignored in them.
Since predictive text input (T9) is always turned off (or completely
unavailable) in full keyboard input, the NON_PREDICTIVE
mode does not have any effect on the editor.
In devices that allow swapping from full keyboard mode to numeric keypad and vice versa, these constraints work as expected in numeric keypad mode.
Symbian platform supports copy/paste functionality.
Pop-up TextBoxes are supported in devices that include Java Runtime 1.3 for S60 or newer. For more information, see section pop-up TextBoxes.
On Symbian devices, the user can insert line separators
to the editor. Each line separator forces a single line break in the
editor. This is visible as an LF character (\n
, U+000A
) in TextBox/TextField getString
or getChars(char[])
. TextBox/TextField
can handle all new line character combinations defined in section New line handling.
The following tables present the different
possible TextBox
modifiers and constraints.
TextBox modifier |
Basic editing style |
---|---|
|
Normal, unconstrained editing.
|
|
Alpha Editing in special URL / email address entry mode.
|
|
Phone number entry (standard number mode).
|
|
Basic number editing:
|
|
As defined in MIDP 2.1 API specification. Only a
decimal separator (period "." or comma “,”),the minus sign "-", and
the decimal digits are allowed in the application-visible text property
of |
Input constraint modifier |
Supported with Input Constraints |
Description of modifier |
---|---|---|
|
All |
Text entered into
|
|
All |
The contents of |
|
|
The modifier sets the editor’s initial case mode to text
case. The user is allowed to change the mode. If predictive text input
method is supported in the implementation, it is possible to use it
also in an |
|
None. This is not supported. If the user tries to set this modifier, the attempt is ignored. |
The modifier sets the editor’s initial case mode to title case. |
|
|
Disables predictive text input method. |
The JTWI
Specification mandates access to device phone book from a PHONENUMBER
type TextBox/TextField
.
If the focus is on a TextField
or TextBox
with a PHONENUMBER
type,
the user interface allows the user to activate a feature that allows
him/her to select a single phone number from the system phonebook
or contacts database.
The selected phone number replaces the contents of TextBox/TextField
. This feature uses a system-specific
UI for the phone number fetch.
If the UNEDITABLE
constraint is set, the
phonebook fetch operation is not visible in the UI.
If the focus is on a TextField
or TextBox
with the EMAILADDR
type,
the user interface allows the user to activate a feature that allows
him/her to select a single e-mail address from the system phone book
or contacts database.
The selected address replaces the contents of TextBox/TextField
. This feature uses system-specific UI for the phone number fetch.
If the UNEDITABLE
constraint is set, then
the phone book fetch operation is not visible in the UI.
MIDlet can set the initial input mode by calling
the setInitialInputMode(String characterSubset)
method.
The parameter characterSubset
is a character
subset specifier string, which can be a Unicode character block name
(java.lang.Character.UnicodeBlock
), an input
subset as defined by the Java SE class java.awt.im.InputSubset
, or a MIDP-defined subset.
Editor (native) properties |
|||
---|---|---|---|
MIDP input mode |
Local input language |
Input mode |
Casing |
|
If the common input language or the display language in the device is a Latin language, that language is used as the local input language, otherwise English is used. |
Latin text input mode; in Japanese, half width Latin mode |
Text case |
|
Input language is not changed. |
Number input mode |
- |
|
See |
See |
Upper case |
|
See |
See |
Lower case |
|
See |
See |
Text case |
|
Greek |
Text input mode |
Text case |
|
If the common input language or the display language in the device is a Cyrillic language, that language is used as the local input language, otherwise Russian is used. |
Text input mode |
Text case |
|
Hebrew |
Text input mode |
- |
|
If the common input language or the display language in the device is an Arabic language, that language is used as the local input language, otherwise Arabic is used. |
Text input mode |
- |
|
Thai |
Text input mode |
- |
|
Japanese |
Hiragana/kanji input mode |
- |
|
Japanese |
Katakana input mode, full width |
- |
|
Japanese |
Katakana input mode, half width |
- |
|
Japanese |
Hiragana/kanji input mode |
- |
|
Japanese |
Number input mode, full width |
- |
|
Japanese |
Latin input mode, full width |
Text case |
|
Chinese Simplified (Peoples Republic of China) |
The default input method, which normally is Pinyin but the user may have changed it in General Settings. |
- |
|
If the common input language or the display language in the device is a Traditional Hanzi language, that language is used as the local input language, otherwise the local input language is not changed. |
The default input method, which normally is Stroke for Hong Kong and Zhuyin for Taiwan but the user may have changed it in General Settings. |
- |
Note: Automatic character casing modes (such as text
case) are not used with constraints EMAILADDR
, URL
or PASSWORD
, although
mentioned in the above table.
For information on TextBox
implementation in Touch UI -enabled devices, see
section Displayables
and commands.