< prev index next >

jdk/src/java.desktop/share/classes/java/awt/TextField.java

Print this page




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package java.awt;
  26 
  27 import java.awt.peer.TextFieldPeer;
  28 import java.awt.event.*;
  29 import java.util.EventListener;
  30 import java.io.ObjectOutputStream;
  31 import java.io.ObjectInputStream;
  32 import java.io.IOException;
  33 import javax.accessibility.*;
  34 
  35 
  36 /**
  37  * A <code>TextField</code> object is a text component
  38  * that allows for the editing of a single line of text.


  39  * <p>
  40  * For example, the following image depicts a frame with four
  41  * text fields of varying widths. Two of these text fields
  42  * display the predefined text <code>"Hello"</code>.
  43  * <p>
  44  * <img src="doc-files/TextField-1.gif" alt="The preceding text describes this image."
  45  * style="float:center; margin: 7px 10px;">
  46  * <p>
  47  * Here is the code that produces these four text fields:
  48  *
  49  * <hr><blockquote><pre>
  50  * TextField tf1, tf2, tf3, tf4;
  51  * // a blank text field
  52  * tf1 = new TextField();
  53  * // blank field of 20 columns
  54  * tf2 = new TextField("", 20);
  55  * // predefined text displayed
  56  * tf3 = new TextField("Hello!");
  57  * // predefined text in 30 columns
  58  * tf4 = new TextField("Hello", 30);




  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package java.awt;
  26 
  27 import java.awt.peer.TextFieldPeer;
  28 import java.awt.event.*;
  29 import java.util.EventListener;
  30 import java.io.ObjectOutputStream;
  31 import java.io.ObjectInputStream;
  32 import java.io.IOException;
  33 import javax.accessibility.*;
  34 
  35 
  36 /**
  37  * A <code>TextField</code> object is a text component
  38  * that allows for the editing of a single line of text.
  39  * If the input text contains new line character,
  40  * it will be replaced by a space character.
  41  * <p>
  42  * For example, the following image depicts a frame with four
  43  * text fields of varying widths. Two of these text fields
  44  * display the predefined text <code>"Hello"</code>.
  45  * <p>
  46  * <img src="doc-files/TextField-1.gif" alt="The preceding text describes this image."
  47  * style="float:center; margin: 7px 10px;">
  48  * <p>
  49  * Here is the code that produces these four text fields:
  50  *
  51  * <hr><blockquote><pre>
  52  * TextField tf1, tf2, tf3, tf4;
  53  * // a blank text field
  54  * tf1 = new TextField();
  55  * // blank field of 20 columns
  56  * tf2 = new TextField("", 20);
  57  * // predefined text displayed
  58  * tf3 = new TextField("Hello!");
  59  * // predefined text in 30 columns
  60  * tf4 = new TextField("Hello", 30);


< prev index next >