src/share/classes/javax/swing/JTextField.java

Print this page




  27 import sun.swing.SwingUtilities2;
  28 
  29 import java.awt.*;
  30 import java.awt.event.*;
  31 import java.beans.*;
  32 import javax.swing.text.*;
  33 import javax.swing.plaf.*;
  34 import javax.swing.event.*;
  35 import javax.accessibility.*;
  36 
  37 import java.io.ObjectOutputStream;
  38 import java.io.ObjectInputStream;
  39 import java.io.IOException;
  40 import java.io.Serializable;
  41 
  42 /**
  43  * <code>JTextField</code> is a lightweight component that allows the editing
  44  * of a single line of text.
  45  * For information on and examples of using text fields,
  46  * see
  47  * <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html">How to Use Text Fields</a>
  48  * in <em>The Java Tutorial.</em>
  49  *
  50  * <p>
  51  * <code>JTextField</code> is intended to be source-compatible
  52  * with <code>java.awt.TextField</code> where it is reasonable to do so.  This
  53  * component has capabilities not found in the <code>java.awt.TextField</code>
  54  * class.  The superclass should be consulted for additional capabilities.
  55  * <p>
  56  * <code>JTextField</code> has a method to establish the string used as the
  57  * command string for the action event that gets fired.  The
  58  * <code>java.awt.TextField</code> used the text of the field as the command
  59  * string for the <code>ActionEvent</code>.
  60  * <code>JTextField</code> will use the command
  61  * string set with the <code>setActionCommand</code> method if not <code>null</code>,
  62  * otherwise it will use the text of the field as a compatibility with
  63  * <code>java.awt.TextField</code>.
  64  * <p>
  65  * The method <code>setEchoChar</code> and <code>getEchoChar</code>
  66  * are not provided directly to avoid a new implementation of a
  67  * pluggable look-and-feel inadvertently exposing password characters.




  27 import sun.swing.SwingUtilities2;
  28 
  29 import java.awt.*;
  30 import java.awt.event.*;
  31 import java.beans.*;
  32 import javax.swing.text.*;
  33 import javax.swing.plaf.*;
  34 import javax.swing.event.*;
  35 import javax.accessibility.*;
  36 
  37 import java.io.ObjectOutputStream;
  38 import java.io.ObjectInputStream;
  39 import java.io.IOException;
  40 import java.io.Serializable;
  41 
  42 /**
  43  * <code>JTextField</code> is a lightweight component that allows the editing
  44  * of a single line of text.
  45  * For information on and examples of using text fields,
  46  * see
  47  * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/textfield.html">How to Use Text Fields</a>
  48  * in <em>The Java Tutorial.</em>
  49  *
  50  * <p>
  51  * <code>JTextField</code> is intended to be source-compatible
  52  * with <code>java.awt.TextField</code> where it is reasonable to do so.  This
  53  * component has capabilities not found in the <code>java.awt.TextField</code>
  54  * class.  The superclass should be consulted for additional capabilities.
  55  * <p>
  56  * <code>JTextField</code> has a method to establish the string used as the
  57  * command string for the action event that gets fired.  The
  58  * <code>java.awt.TextField</code> used the text of the field as the command
  59  * string for the <code>ActionEvent</code>.
  60  * <code>JTextField</code> will use the command
  61  * string set with the <code>setActionCommand</code> method if not <code>null</code>,
  62  * otherwise it will use the text of the field as a compatibility with
  63  * <code>java.awt.TextField</code>.
  64  * <p>
  65  * The method <code>setEchoChar</code> and <code>getEchoChar</code>
  66  * are not provided directly to avoid a new implementation of a
  67  * pluggable look-and-feel inadvertently exposing password characters.