A good answer might be:

The Java documentation from Sun Microsystems is the best place.

Application with a Text Field

You may have this documentation on your computer already, perhaps at C:\jdk1.3.1\docs\index.html or a similar location. Follow a path to

C:\jdk1.3.1\docs\api\javax\swing\text\JTextComponent.html

Look around a bit to see how these notes relate to the official documentation. The purpose of these notes is to overview the Swing package. Look to the documentation for complete coverage. If you can't find the Java documentation on your system you might not have downloaded it from Sun.

Here is (of several) constructors for JTextField. The parameter says how many characters wide the field is.

JTextField( int numChars ) 

This simple program that displays the frame at right.

import java.awt.*; 
import java.awt.event.*;
import javax.swing.*;

public class TextEg1 extends _______
{

  _________ text;

  // constructor for TextEg1
  public TextEg1()
  {  
    text = new _______________;
    getContentPane().setLayout( new FlowLayout() );
    getContentPane().add( text )
  }

  public static void main ( String[] args )
  {
    . . . . .
  }

  . . . . .
}

QUESTION 4:

Fill in the blanks so that the field is 15 characters wide.