O'Reilly logo

LWUIT 1.1 for Java ME Developers by Biswajit Sarkar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The TextField class

The TextField class is an inelastic single-line version of the TextArea class that can be edited optionally without opening a separate screen. While it never grows beyond a single line, it can accept long texts. The limitation lies in the fact that only one line will be displayed, and the line width will be limited by the available screen area.

Creating a TextField

We can choose from a set of four constructors for creating an instance of the TextField class.

Constructor

Parameters

Description

TextField()

Creates an empty text field.

TextField (int columns )

columns—the number of columns

Creates an empty text field with the given number of columns.

TextField(String text)

text—initial text to be displayed

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required