Technical Support
Discussion Forum
Online Training
Read About Java
Java In-Depth
Product Discounts
Membership Information

Java Cup Logo

JDC Home Page


Top
Back
Next
Online Training
shadowSearchFAQFeedback

TextField

A TextField is a simple scrollable text display object with one row of characters. The width of field is specified during construction and an initial string can be specified.



Corresponding source code:

import java.applet.*;
import java.awt.*;
public class TextFieldWidget extends Applet {
    public void init()
    {
        TextField f1 = new TextField("type something");
        add(f1);
    }
}

Methods:

  • public TextField(String text)
    Creates a TextField with the specified initial contents.
  • public TextField(String text, int cols)
    Creates a TextField with the specified initial contents and initial number of columns.

Related exercises: