J2ME Text Box Example
This application illustrates how to create the text box using TextBox class. The TextBox class is a Screen that allows the user to enter and edit text. A TextBox has a maximum size, which is the maximum number of characters that can be stored in the object at any time. The following are the methods used in class:
- delete(int offset, int length)
- getCaretPosition()
- getChars(char[] data)
- getConstraints()
- getMaxSize()
- getString()
- insert(char[] data, int offset, int length, int position)
- insert(String src, int position)
- setChars(char[] data, int offset, int length)
- setConstraints(int constraints)
- setMaxSize(int maxSize)
- setString(String text)
- size()
These methods are accessible in your MIDlet. The application is as follows:
TextBoxMIDlet.java
import javax.microedition.midlet.*;
|