Java Doc for TextField.java in  » 6.0-JDK-Modules » j2me » javax » microedition » lcdui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.lcdui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.microedition.lcdui.Item
      javax.microedition.lcdui.TextField

TextField
public class TextField extends Item (Code)
A TextField is an editable text component that may be placed into a Form Form . It can be given a piece of text that is used as the initial value.

A TextField has a maximum size, which is the maximum number of characters that can be stored in the object at any time (its capacity). This limit is enforced when the TextField instance is constructed, when the user is editing text within the TextField, as well as when the application program calls methods on the TextField that modify its contents. The maximum size is the maximum stored capacity and is unrelated to the number of characters that may be displayed at any given time. The number of characters displayed and their arrangement into rows and columns are determined by the device.

The implementation may place a boundary on the maximum size, and the maximum size actually assigned may be smaller than the application had requested. The value actually assigned will be reflected in the value returned by TextField.getMaxSize() getMaxSize() . A defensively-written application should compare this value to the maximum size requested and be prepared to handle cases where they differ.

Input Constraints

The TextField shares the concept of input constraints with the TextBox TextBox class. The different constraints allow the application to request that the user's input be restricted in a variety of ways. The implementation is required to restrict the user's input as requested by the application. For example, if the application requests the NUMERIC constraint on a TextField, the implementation must allow only numeric characters to be entered.

The actual contents of the text object are set and modified by and are reported to the application through the TextBox and TextField APIs. The displayed contents may differ from the actual contents if the implementation has chosen to provide special formatting suitable for the text object's constraint setting. For example, a PHONENUMBER field might be displayed with digit separators and punctuation as appropriate for the phone number conventions in use, grouping the digits into country code, area code, prefix, etc. Any spaces or punctuation provided are not considered part of the text object's actual contents. For example, a text object with the PHONENUMBER constraint might display as follows:


 (408) 555-1212    

but the actual contents of the object visible to the application through the APIs would be the string "4085551212". The size method reflects the number of characters in the actual contents, not the number of characters that are displayed, so for this example the size method would return 10.

Some constraints, such as DECIMAL, require the implementation to perform syntactic validation of the contents of the text object. The syntax checking is performed on the actual contents of the text object, which may differ from the displayed contents as described above. Syntax checking is performed on the initial contents passed to the constructors, and it is also enforced for all method calls that affect the contents of the text object. The methods and constructors throw IllegalArgumentException if they would result in the contents of the text object not conforming to the required syntax.

The value passed to the TextField.setConstraints setConstraints() method consists of a restrictive constraint setting described above, as well as a variety of flag bits that modify the behavior of text entry and display. The value of the restrictive constraint setting is in the low order 16 bits of the value, and it may be extracted by combining the constraint value with the CONSTRAINT_MASK constant using the bit-wise AND (&) operator. The restrictive constraint settings are as follows:

ANY
EMAILADDR
NUMERIC
PHONENUMBER
URL
DECIMAL

The modifier flags reside in the high order 16 bits of the constraint value, that is, those in the complement of the CONSTRAINT_MASK constant. The modifier flags may be tested individually by combining the constraint value with a modifier flag using the bit-wise AND (&) operator. The modifier flags are as follows:

PASSWORD
UNEDITABLE
SENSITIVE
NON_PREDICTIVE
INITIAL_CAPS_WORD
INITIAL_CAPS_SENTENCE

Input Modes

The TextField shares the concept of input modes with the TextBox TextBox class. The application can request that the implementation use a particular input mode when the user initiates editing of a TextField or TextBox. The input mode is a concept that exists within the user interface for text entry on a particular device. The application does not request an input mode directly, since the user interface for text entry is not standardized across devices. Instead, the application can request that the entry of certain characters be made convenient. It can do this by passing the name of a Unicode character subset to the TextField.setInitialInputMode setInitialInputMode() method. Calling this method requests that the implementation set the mode of the text entry user interface so that it is convenient for the user to enter characters in this subset. The application can also request that the input mode have certain behavioral characteristics by setting modifier flags in the constraints value.

The requested input mode should be used whenever the user initiates the editing of a TextBox or TextField object. If the user had changed input modes in a previous editing session, the application's requested input mode should take precedence over the previous input mode set by the user. However, the input mode is not restrictive, and the user is allowed to change the input mode at any time during editing. If editing is already in progress, calls to the setInitialInputMode method do not affect the current input mode, but instead take effect at the next time the user initiates editing of this text object.

The initial input mode is a hint to the implementation. If the implementation cannot provide an input mode that satisfies the application's request, it should use a default input mode.

The input mode that results from the application's request is not a restriction on the set of characters the user is allowed to enter. The user MUST be allowed to switch input modes to enter any character that is allowed within the current constraint setting. The constraint setting takes precedence over an input mode request, and the implementation may refuse to supply a particular input mode if it is inconsistent with the current constraint setting.

For example, if the current constraint is ANY, the call


 setInitialInputMode("MIDP_UPPERCASE_LATIN");    

should set the initial input mode to allow entry of uppercase Latin characters. This does not restrict input to these characters, and the user will be able to enter other characters by switching the input mode to allow entry of numerals or lowercase Latin letters. However, if the current constraint is NUMERIC, the implementation may ignore the request to set an initial input mode allowing MIDP_UPPERCASE_LATIN characters because these characters are not allowed in a TextField whose constraint is NUMERIC. In this case, the implementation may instead use an input mode that allows entry of numerals, since such an input mode is most appropriate for entry of data under the NUMERIC constraint.

A string is used to name the Unicode character subset passed as a parameter to the TextField.setInitialInputMode setInitialInputMode() method. String comparison is case sensitive.

Unicode character blocks can be named by adding the prefix "UCB_" to the the string names of fields representing Unicode character blocks as defined in the J2SE class java.lang.Character.UnicodeBlock. Any Unicode character block may be named in this fashion. For convenience, the most common Unicode character blocks are listed below.

UCB_BASIC_LATIN
UCB_GREEK
UCB_CYRILLIC
UCB_ARMENIAN
UCB_HEBREW
UCB_ARABIC
UCB_DEVANAGARI
UCB_BENGALI
UCB_THAI
UCB_HIRAGANA
UCB_KATAKANA
UCB_HANGUL_SYLLABLES

"Input subsets" as defined by the J2SE class java.awt.im.InputSubset may be named by adding the prefix "IS_" to the string names of fields representing input subsets as defined in that class. Any defined input subset may be used. For convenience, the names of the currently defined input subsets are listed below.

IS_FULLWIDTH_DIGITS
IS_FULLWIDTH_LATIN
IS_HALFWIDTH_KATAKANA
IS_HANJA
IS_KANJI
IS_LATIN
IS_LATIN_DIGITS
IS_SIMPLIFIED_HANZI
IS_TRADITIONAL_HANZI

MIDP has also defined the following character subsets:

MIDP_UPPERCASE_LATIN - the subset of IS_LATIN that corresponds to uppercase Latin letters
MIDP_LOWERCASE_LATIN - the subset of IS_LATIN that corresponds to lowercase Latin letters

Finally, implementation-specific character subsets may be named with strings that have a prefix of "X_". In order to avoid namespace conflicts, it is recommended that implementation-specific names include the name of the defining company or organization after the initial "X_" prefix.

For example, a Japanese language application might have a particular TextField that the application intends to be used primarily for input of words that are "loaned" from languages other than Japanese. The application might request an input mode facilitating Hiragana input by issuing the following method call:


 textfield.setInitialInputMode("UCB_HIRAGANA");       

Implementation Note

Implementations need not compile in all the strings listed above. Instead, they need only to compile in the strings that name Unicode character subsets that they support. If the subset name passed by the application does not match a known subset name, the request should simply be ignored without error, and a default input mode should be used. This lets implementations support this feature reasonably inexpensively. However, it has the consequence that the application cannot tell whether its request has been accepted, nor whether the Unicode character subset it has requested is actually a valid subset.
since:
   MIDP 1.0



Field Summary
final public static  intANY
     The user is allowed to enter any text.
final public static  intCONSTRAINT_MASK
     The mask value for determining the constraint mode.
final public static  intDECIMAL
     The user is allowed to enter numeric values with optional decimal fractions, for example "-123", "0.123", or ".5".

The implementation may display a period "." or a comma "," for the decimal fraction separator, depending on the conventions in use on the device.

final public static  intEMAILADDR
     The user is allowed to enter an e-mail address.
final public static  intINITIAL_CAPS_SENTENCE
     This flag is a hint to the implementation that during text editing, the initial letter of each sentence should be capitalized.
final public static  intINITIAL_CAPS_WORD
     This flag is a hint to the implementation that during text editing, the initial letter of each word should be capitalized.
final public static  intNON_PREDICTIVE
     Indicates that the text entered does not consist of words that are likely to be found in dictionaries typically used by predictive input schemes.
final public static  intNUMERIC
     The user is allowed to enter only an integer value.
final public static  intPASSWORD
     Indicates that the text entered is confidential data that should be obscured whenever possible.
final public static  intPHONENUMBER
     The user is allowed to enter a phone number.
final public static  intSENSITIVE
     Indicates that the text entered is sensitive data that the implementation must never store into a dictionary or table for use in predictive, auto-completing, or other accelerated input schemes.
final public static  intUNEDITABLE
     Indicates that editing is currently disallowed.
final public static  intURL
     The user is allowed to enter a URL.
 DynamicCharacterArraybuffer
    
 intconstraints
    
 StringinitialInputMode
    
 TextFieldLFtextFieldLF
     The look&feel associated with this TextField.

Constructor Summary
public  TextField(String label, String text, int maxSize, int constraints)
     Creates a new TextField object with the given label, initial contents, maximum size in characters, and constraints. If the text parameter is null, the TextField is created empty. The maxSize parameter must be greater than zero. An IllegalArgumentException is thrown if the length of the initial contents string exceeds maxSize. However, the implementation may assign a maximum size smaller than the application had requested.
 TextField(String label, String text, int maxSize, int constraints, boolean forTextBox)
     Creates a new TextField object with the given label, initial contents, maximum size in characters, and constraints.

Method Summary
 booleanacceptFocus()
     Return whether the Item takes user input focus.
public  voiddelete(int offset, int length)
     Deletes characters from the TextField.
 voiddeleteImpl(int offset, int length)
     Deletes characters from the TextField.
public  intgetCaretPosition()
     Gets the current input position.
public  intgetChars(char[] data)
     Copies the contents of the TextField into a character array starting at index zero.
public  intgetConstraints()
     Gets the current input constraints of the TextField.
public  intgetMaxSize()
     Returns the maximum size (number of characters) that can be stored in this TextField.
public  StringgetString()
     Gets the contents of the TextField as a string value.
public  voidinsert(String src, int position)
     Inserts a string into the contents of the TextField.
public  voidinsert(char[] data, int offset, int length, int position)
     Inserts a subrange of an array of characters into the contents of the TextField.
 voidinsertImpl(char data, int offset, int length, int position)
     Inserts data into the buffer.
 voiditemDeleted()
     Notify the item to the effect that it has been recently deleted.
public  voidsetChars(char[] data, int offset, int length)
     Sets the contents of the TextField from a character array, replacing the previous contents.
 voidsetCharsImpl(char[] data, int offset, int length)
     Sets the contents of the TextField from a character array, replacing the previous contents.
public  voidsetConstraints(int constraints)
     Sets the input constraints of the TextField.
 voidsetConstraintsImpl(int constraints)
     Sets the input constraints of the TextField.
public  voidsetInitialInputMode(String characterSubset)
     Sets a hint to the implementation as to the input mode that should be used when the user initiates editing of this TextField.
public  intsetMaxSize(int maxSize)
     Sets the maximum size (number of characters) that can be contained in this TextField.
public  voidsetString(String text)
     Sets the contents of the TextField as a string value, replacing the previous contents.
public  intsize()
     Gets the number of characters that are currently stored in this TextField.

Field Detail
ANY
final public static int ANY(Code)
The user is allowed to enter any text. Line breaks may be entered.

Constant 0 is assigned to ANY.




CONSTRAINT_MASK
final public static int CONSTRAINT_MASK(Code)
The mask value for determining the constraint mode. The application should use the bit-wise AND operation with a value returned by getConstraints() and CONSTRAINT_MASK in order to retrieve the current constraint mode, in order to remove any modifier flags such as the PASSWORD flag.

Constant 0xFFFF is assigned to CONSTRAINT_MASK.




DECIMAL
final public static int DECIMAL(Code)
The user is allowed to enter numeric values with optional decimal fractions, for example "-123", "0.123", or ".5".

The implementation may display a period "." or a comma "," for the decimal fraction separator, depending on the conventions in use on the device. Similarly, the implementation may display other device-specific characters as part of a decimal string, such as spaces or commas for digit separators. However, the only characters allowed in the actual contents of the text object are period ".", minus sign "-", and the decimal digits.

The actual contents of a DECIMAL text object may be empty. If the actual contents are not empty, they must conform to a subset of the syntax for a FloatingPointLiteral as defined by the Java Language Specification, section 3.10.2. This subset syntax is defined as follows: the actual contents must consist of an optional minus sign "-", followed by one or more whole-number decimal digits, followed by an optional fraction separator, followed by zero or more decimal fraction digits. The whole-number decimal digits may be omitted if the fraction separator and one or more decimal fraction digits are present.

The syntax defined above is also enforced whenever the application attempts to set or modify the contents of the text object by calling a constructor or a method.

Parsing this string value into a numeric value suitable for computation is the responsibility of the application. If the contents are not empty, the result can be parsed successfully by Double.valueOf and related methods if they are present in the runtime environment.

The sign and the fraction separator consume space in the text object. Applications should account for this when assigning a maximum size for the text object.

Constant 5 is assigned to DECIMAL.




EMAILADDR
final public static int EMAILADDR(Code)
The user is allowed to enter an e-mail address.

Constant 1 is assigned to EMAILADDR.




INITIAL_CAPS_SENTENCE
final public static int INITIAL_CAPS_SENTENCE(Code)
This flag is a hint to the implementation that during text editing, the initial letter of each sentence should be capitalized. This hint should be honored only on devices for which automatic capitalization is appropriate and when the character set of the text being edited has the notion of upper case and lower case letters. The definition of sentence boundaries is implementation-specific.

If the application specifies both the INITIAL_CAPS_WORD and the INITIAL_CAPS_SENTENCE flags, INITIAL_CAPS_WORD behavior should be used.

The INITIAL_CAPS_SENTENCE modifier can be combined with other input constraints by using the bit-wise OR operator (|).

Constant 0x200000 is assigned to INITIAL_CAPS_SENTENCE.




INITIAL_CAPS_WORD
final public static int INITIAL_CAPS_WORD(Code)
This flag is a hint to the implementation that during text editing, the initial letter of each word should be capitalized. This hint should be honored only on devices for which automatic capitalization is appropriate and when the character set of the text being edited has the notion of upper case and lower case letters. The definition of word boundaries is implementation-specific.

If the application specifies both the INITIAL_CAPS_WORD and the INITIAL_CAPS_SENTENCE flags, INITIAL_CAPS_WORD behavior should be used.

The INITIAL_CAPS_WORD modifier can be combined with other input constraints by using the bit-wise OR operator (|).

Constant 0x100000 is assigned to INITIAL_CAPS_WORD.




NON_PREDICTIVE
final public static int NON_PREDICTIVE(Code)
Indicates that the text entered does not consist of words that are likely to be found in dictionaries typically used by predictive input schemes. If this bit is clear, the implementation is allowed to (but is not required to) use predictive input facilities. If this bit is set, the implementation should not use any predictive input facilities, but it instead should allow character-by-character text entry.

The NON_PREDICTIVE modifier can be combined with other input constraints by using the bit-wise OR operator (|).

Constant 0x80000 is assigned to NON_PREDICTIVE.




NUMERIC
final public static int NUMERIC(Code)
The user is allowed to enter only an integer value. The implementation must restrict the contents either to be empty or to consist of an optional minus sign followed by a string of one or more decimal numerals. Unless the value is empty, it will be successfully parsable using java.lang.Integer.parseInt(String) .

The minus sign consumes space in the text object. It is thus impossible to enter negative numbers into a text object whose maximum size is 1.

Constant 2 is assigned to NUMERIC.




PASSWORD
final public static int PASSWORD(Code)
Indicates that the text entered is confidential data that should be obscured whenever possible. The contents may be visible while the user is entering data. However, the contents must never be divulged to the user. In particular, the existing contents must not be shown when the user edits the contents. The means by which the contents are obscured is implementation-dependent. For example, each character of the data might be masked with a "*" character. The PASSWORD modifier is useful for entering confidential information such as passwords or personal identification numbers (PINs).

Data entered into a PASSWORD field is treated similarly to SENSITIVE in that the implementation must never store the contents into a dictionary or table for use in predictive, auto-completing, or other accelerated input schemes. If the PASSWORD bit is set in a constraint value, the SENSITIVE and NON_PREDICTIVE bits are also considered to be set, regardless of their actual values. In addition, the INITIAL_CAPS_WORD and INITIAL_CAPS_SENTENCE flag bits should be ignored even if they are set.

The PASSWORD modifier can be combined with other input constraints by using the bit-wise OR operator (|). The PASSWORD modifier is not useful with some constraint values such as EMAILADDR, PHONENUMBER, and URL. These combinations are legal, however, and no exception is thrown if such a constraint is specified.

Constant 0x10000 is assigned to PASSWORD.




PHONENUMBER
final public static int PHONENUMBER(Code)
The user is allowed to enter a phone number. The phone number is a special case, since a phone-based implementation may be linked to the native phone dialing application. The implementation may automatically start a phone dialer application that is initialized so that pressing a single key would be enough to make a call. The call must not made automatically without requiring user's confirmation. Implementations may also provide a feature to look up the phone number in the device's phone or address database.

The exact set of characters allowed is specific to the device and to the device's network and may include non-numeric characters, such as a "+" prefix character.

Some platforms may provide the capability to initiate voice calls using the javax.microedition.midlet.MIDlet.platformRequestMIDlet.platformRequest method.

Constant 3 is assigned to PHONENUMBER.




SENSITIVE
final public static int SENSITIVE(Code)
Indicates that the text entered is sensitive data that the implementation must never store into a dictionary or table for use in predictive, auto-completing, or other accelerated input schemes. A credit card number is an example of sensitive data.

The SENSITIVE modifier can be combined with other input constraints by using the bit-wise OR operator (|).

Constant 0x40000 is assigned to SENSITIVE.




UNEDITABLE
final public static int UNEDITABLE(Code)
Indicates that editing is currently disallowed. When this flag is set, the implementation must prevent the user from changing the text contents of this object. The implementation should also provide a visual indication that the object's text cannot be edited. The intent of this flag is that this text object has the potential to be edited, and that there are circumstances where the application will clear this flag and allow the user to edit the contents.

The UNEDITABLE modifier can be combined with other input constraints by using the bit-wise OR operator (|).

Constant 0x20000 is assigned to UNEDITABLE.




URL
final public static int URL(Code)
The user is allowed to enter a URL.

Constant 4 is assigned to URL.




buffer
DynamicCharacterArray buffer(Code)
buffer to store the text



constraints
int constraints(Code)
Input constraints



initialInputMode
String initialInputMode(Code)
the initial input mode for when the text field gets focus



textFieldLF
TextFieldLF textFieldLF(Code)
The look&feel associated with this TextField. Set in the constructor.




Constructor Detail
TextField
public TextField(String label, String text, int maxSize, int constraints)(Code)
Creates a new TextField object with the given label, initial contents, maximum size in characters, and constraints. If the text parameter is null, the TextField is created empty. The maxSize parameter must be greater than zero. An IllegalArgumentException is thrown if the length of the initial contents string exceeds maxSize. However, the implementation may assign a maximum size smaller than the application had requested. If this occurs, and if the length of the contents exceeds the newly assigned maximum size, the contents are truncated from the end in order to fit, and no exception is thrown.
Parameters:
  label - item label
Parameters:
  text - the initial contents, or null if theTextField is to be empty
Parameters:
  maxSize - the maximum capacity in characters
Parameters:
  constraints - see input constraints
throws:
  IllegalArgumentException - if maxSize is zero or less
throws:
  IllegalArgumentException - if the value of the constraintsparameteris invalid
throws:
  IllegalArgumentException - if text is illegalfor the specified constraints
throws:
  IllegalArgumentException - if the length of the string exceedsthe requested maximum capacity



TextField
TextField(String label, String text, int maxSize, int constraints, boolean forTextBox)(Code)
Creates a new TextField object with the given label, initial contents, maximum size in characters, and constraints. Behaves the same as the public TextField constructor above except for an additional argument forTextBox which signals this TextField will be used alone as a TextBox widget.
Parameters:
  label - item label
Parameters:
  text - the initial contents, or null if theTextField is to be empty
Parameters:
  maxSize - the maximum capacity in characters
Parameters:
  constraints - see input constraints
Parameters:
  forTextBox - true if this textField will be used to implementa TextBox object. when false, this method's results areidentical to the public TextField constructor.
throws:
  IllegalArgumentException - if maxSize is zero or less
throws:
  IllegalArgumentException - if the value of the constraintsparameteris invalid
throws:
  IllegalArgumentException - if text is illegalfor the specified constraints
throws:
  IllegalArgumentException - if the length of the string exceedsthe requested maximum capacity




Method Detail
acceptFocus
boolean acceptFocus()(Code)
Return whether the Item takes user input focus. Always return true so user can scrollor highlight selection.



delete
public void delete(int offset, int length)(Code)
Deletes characters from the TextField.

The offset and length parameters must specify a valid range of characters within the contents of the TextField. The offset parameter must be within the range [0..(size())], inclusive. The length parameter must be a non-negative integer such that (offset + length) <= size().


Parameters:
  offset - the beginning of the region to be deleted
Parameters:
  length - the number of characters to be deleted
throws:
  IllegalArgumentException - if the resulting contentswould be illegal for the currentinput constraints
throws:
  StringIndexOutOfBoundsException - if offsetand length do notspecify a valid range within the contents of the TextField



deleteImpl
void deleteImpl(int offset, int length)(Code)
Deletes characters from the TextField.

The offset and length parameters must specify a valid range of characters within the contents of the TextField. The offset parameter must be within the range [0..(size())], inclusive. The length parameter must be a non-negative integer such that (offset + length) <= size().


Parameters:
  offset - the beginning of the region to be deleted
Parameters:
  length - the number of characters to be deleted
throws:
  IllegalArgumentException - if the resulting contentswould be illegal for the currentinput constraints
throws:
  StringIndexOutOfBoundsException - if offsetand length do notspecify a valid range within the contents of the TextField



getCaretPosition
public int getCaretPosition()(Code)
Gets the current input position. For some UIs this may block and ask the user for the intended caret position, and on other UIs this may simply return the current caret position. the current caret position, 0 if at the beginning



getChars
public int getChars(char[] data)(Code)
Copies the contents of the TextField into a character array starting at index zero. Array elements beyond the characters copied are left unchanged.
Parameters:
  data - the character array to receive the value the number of characters copied
throws:
  ArrayIndexOutOfBoundsException - if the array is too short for thecontents
throws:
  NullPointerException - if data is null
See Also:   TextField.setChars



getConstraints
public int getConstraints()(Code)
Gets the current input constraints of the TextField. the current constraints value (seeinput constraints)
See Also:   TextField.setConstraints



getMaxSize
public int getMaxSize()(Code)
Returns the maximum size (number of characters) that can be stored in this TextField. the maximum size in characters
See Also:   TextField.setMaxSize



getString
public String getString()(Code)
Gets the contents of the TextField as a string value. the current contents
See Also:   TextField.setString



insert
public void insert(String src, int position)(Code)
Inserts a string into the contents of the TextField. The string is inserted just prior to the character indicated by the position parameter, where zero specifies the first character of the contents of the TextField. If position is less than or equal to zero, the insertion occurs at the beginning of the contents, thus effecting a prepend operation. If position is greater than or equal to the current size of the contents, the insertion occurs immediately after the end of the contents, thus effecting an append operation. For example, text.insert(s, text.size()) always appends the string s to the current contents.

The current size of the contents is increased by the number of inserted characters. The resulting string must fit within the current maximum capacity.

If the application needs to simulate typing of characters it can determining the location of the current insertion point ("caret") using the with TextField.getCaretPosition() getCaretPosition() method. For example, text.insert(s, text.getCaretPosition()) inserts the string s at the current caret position.


Parameters:
  src - the String to be inserted
Parameters:
  position - the position at which insertion is to occur
throws:
  IllegalArgumentException - if the resulting contentswould be illegal for the currentinput constraints
throws:
  IllegalArgumentException - if the insertion would exceedthe currentmaximum capacity
throws:
  NullPointerException - if src is null



insert
public void insert(char[] data, int offset, int length, int position)(Code)
Inserts a subrange of an array of characters into the contents of the TextField. The offset and length parameters indicate the subrange of the data array to be used for insertion. Behavior is otherwise identical to TextField.insert(String,int) insert(String, int) .

The offset and length parameters must specify a valid range of characters within the character array data. The offset parameter must be within the range [0..(data.length)], inclusive. The length parameter must be a non-negative integer such that (offset + length) <= data.length.


Parameters:
  data - the source of the character data
Parameters:
  offset - the beginning of the region of characters to copy
Parameters:
  length - the number of characters to copy
Parameters:
  position - the position at which insertion is to occur
throws:
  ArrayIndexOutOfBoundsException - if offsetand length do not specifya valid range within the data array
throws:
  IllegalArgumentException - if the resulting contentswould be illegal for the currentinput constraints
throws:
  IllegalArgumentException - if the insertion would exceedthe currentmaximum capacity
throws:
  NullPointerException - if data is null



insertImpl
void insertImpl(char data, int offset, int length, int position)(Code)
Inserts data into the buffer.
Parameters:
  data - - data to be inserted
Parameters:
  offset - -
Parameters:
  length - -
Parameters:
  position - -



itemDeleted
void itemDeleted()(Code)
Notify the item to the effect that it has been recently deleted. In addition to default action call TraverseOut for the TextField



setChars
public void setChars(char[] data, int offset, int length)(Code)
Sets the contents of the TextField from a character array, replacing the previous contents. Characters are copied from the region of the data array starting at array index offset and running for length characters. If the data array is null, the TextField is set to be empty and the other parameters are ignored.

The offset and length parameters must specify a valid range of characters within the character array data. The offset parameter must be within the range [0..(data.length)], inclusive. The length parameter must be a non-negative integer such that (offset + length) <= data.length.


Parameters:
  data - the source of the character data
Parameters:
  offset - the beginning of the region of characters to copy
Parameters:
  length - the number of characters to copy
throws:
  ArrayIndexOutOfBoundsException - if offsetand length do not specifya valid range within the data array
throws:
  IllegalArgumentException - if datais illegal for the currentinput constraints
throws:
  IllegalArgumentException - if the text would exceed the currentmaximum capacity
See Also:   TextField.getChars



setCharsImpl
void setCharsImpl(char[] data, int offset, int length)(Code)
Sets the contents of the TextField from a character array, replacing the previous contents.
Parameters:
  data - the source of the character data
Parameters:
  offset - the beginning of the region of characters to copy
Parameters:
  length - the number of characters to copy
throws:
  ArrayIndexOutOfBoundsException - if offsetand length do not specifya valid range within the data array
throws:
  IllegalArgumentException - if datais illegal for the currentinput constraints
throws:
  IllegalArgumentException - if the text would exceed the currentmaximum capacity



setConstraints
public void setConstraints(int constraints)(Code)
Sets the input constraints of the TextField. If the the current contents of the TextField do not match the new constraints, the contents are set to empty.
Parameters:
  constraints - see input constraints
throws:
  IllegalArgumentException - if constraints is not any of the onesspecified in input constraints
See Also:   TextField.getConstraints



setConstraintsImpl
void setConstraintsImpl(int constraints)(Code)
Sets the input constraints of the TextField.
Parameters:
  constraints - see input constraints
throws:
  IllegalArgumentException - if constraints is not any of the onesspecified in input constraints



setInitialInputMode
public void setInitialInputMode(String characterSubset)(Code)
Sets a hint to the implementation as to the input mode that should be used when the user initiates editing of this TextField. The characterSubset parameter names a subset of Unicode characters that is used by the implementation to choose an initial input mode. If null is passed, the implementation should choose a default input mode.

See Input Modes for a full explanation of input modes.


Parameters:
  characterSubset - a string naming a Unicode character subset,or null



setMaxSize
public int setMaxSize(int maxSize)(Code)
Sets the maximum size (number of characters) that can be contained in this TextField. If the current contents of the TextField are larger than maxSize, the contents are truncated to fit.
Parameters:
  maxSize - the new maximum size assigned maximum capacity - may be smaller than requested.
throws:
  IllegalArgumentException - if maxSize is zero or less.
throws:
  IllegalArgumentException - if the contentsafter truncation would be illegal for the currentinput constraints
See Also:   TextField.getMaxSize



setString
public void setString(String text)(Code)
Sets the contents of the TextField as a string value, replacing the previous contents.
Parameters:
  text - the new value of the TextField, ornull if the TextField is to be made empty
throws:
  IllegalArgumentException - if textis illegal for the currentinput constraints
throws:
  IllegalArgumentException - if the text would exceed the currentmaximum capacity
See Also:   TextField.getString



size
public int size()(Code)
Gets the number of characters that are currently stored in this TextField. number of characters in the TextField



Fields inherited from javax.microedition.lcdui.Item
final public static int BUTTON(Code)(Java Doc)
final public static int HYPERLINK(Code)(Java Doc)
final public static int LAYOUT_2(Code)(Java Doc)
final public static int LAYOUT_BOTTOM(Code)(Java Doc)
final public static int LAYOUT_CENTER(Code)(Java Doc)
final public static int LAYOUT_DEFAULT(Code)(Java Doc)
final public static int LAYOUT_EXPAND(Code)(Java Doc)
final public static int LAYOUT_LEFT(Code)(Java Doc)
final public static int LAYOUT_NEWLINE_AFTER(Code)(Java Doc)
final public static int LAYOUT_NEWLINE_BEFORE(Code)(Java Doc)
final public static int LAYOUT_RIGHT(Code)(Java Doc)
final public static int LAYOUT_SHRINK(Code)(Java Doc)
final public static int LAYOUT_TOP(Code)(Java Doc)
final public static int LAYOUT_VCENTER(Code)(Java Doc)
final public static int LAYOUT_VEXPAND(Code)(Java Doc)
final public static int LAYOUT_VSHRINK(Code)(Java Doc)
final public static int PLAIN(Code)(Java Doc)
final static int VALID_LAYOUT(Code)(Java Doc)
ItemCommandListener commandListener(Code)(Java Doc)
Command commands(Code)(Java Doc)
Command defaultCommand(Code)(Java Doc)
ItemLF itemLF(Code)(Java Doc)
String label(Code)(Java Doc)
int layout(Code)(Java Doc)
int lockedHeight(Code)(Java Doc)
int lockedWidth(Code)(Java Doc)
int numCommands(Code)(Java Doc)
Screen owner(Code)(Java Doc)
int userPreferredHeight(Code)(Java Doc)
int userPreferredWidth(Code)(Java Doc)

Methods inherited from javax.microedition.lcdui.Item
boolean acceptFocus()(Code)(Java Doc)
public void addCommand(Command cmd)(Code)(Java Doc)
ItemLF getLF()(Code)(Java Doc)
public String getLabel()(Code)(Java Doc)
public int getLayout()(Code)(Java Doc)
public int getMinimumHeight()(Code)(Java Doc)
public int getMinimumWidth()(Code)(Java Doc)
public int getPreferredHeight()(Code)(Java Doc)
public int getPreferredWidth()(Code)(Java Doc)
void itemDeleted()(Code)(Java Doc)
void lSetOwner(Screen owner)(Code)(Java Doc)
void lUpdateLockedSize()(Code)(Java Doc)
public void notifyStateChanged()(Code)(Java Doc)
public void removeCommand(Command cmd)(Code)(Java Doc)
void removeCommandImpl(Command cmd)(Code)(Java Doc)
public void setDefaultCommand(Command cmd)(Code)(Java Doc)
public void setItemCommandListener(ItemCommandListener l)(Code)(Java Doc)
public void setLabel(String label)(Code)(Java Doc)
public void setLayout(int layout)(Code)(Java Doc)
void setLayoutImpl(int layout)(Code)(Java Doc)
public void setPreferredSize(int width, int height)(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.