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

Print this page




  27 import java.awt.*;
  28 import java.awt.event.*;
  29 import javax.swing.text.*;
  30 import javax.swing.plaf.*;
  31 import javax.accessibility.*;
  32 
  33 import java.util.Collections;
  34 import java.util.Set;
  35 import java.util.StringTokenizer;
  36 
  37 import java.io.ObjectOutputStream;
  38 import java.io.ObjectInputStream;
  39 import java.io.IOException;
  40 
  41 /**
  42  * A <code>JTextArea</code> is a multi-line area that displays plain text.
  43  * It is intended to be a lightweight component that provides source
  44  * compatibility with the <code>java.awt.TextArea</code> class where it can
  45  * reasonably do so.
  46  * You can find information and examples of using all the text components in
  47  * <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/text.html">Using Text Components</a>,
  48  * a section in <em>The Java Tutorial.</em>
  49  *
  50  * <p>
  51  * This component has capabilities not found in the
  52  * <code>java.awt.TextArea</code> class.  The superclass should be
  53  * consulted for additional capabilities.
  54  * Alternative multi-line text classes with
  55  * more capabilities are <code>JTextPane</code> and <code>JEditorPane</code>.
  56  * <p>
  57  * The <code>java.awt.TextArea</code> internally handles scrolling.
  58  * <code>JTextArea</code> is different in that it doesn't manage scrolling,
  59  * but implements the swing <code>Scrollable</code> interface.  This allows it
  60  * to be placed inside a <code>JScrollPane</code> if scrolling
  61  * behavior is desired, and used directly if scrolling is not desired.
  62  * <p>
  63  * The <code>java.awt.TextArea</code> has the ability to do line wrapping.
  64  * This was controlled by the horizontal scrolling policy.  Since
  65  * scrolling is not done by <code>JTextArea</code> directly, backward
  66  * compatibility must be provided another way.  <code>JTextArea</code> has
  67  * a bound property for line wrapping that controls whether or




  27 import java.awt.*;
  28 import java.awt.event.*;
  29 import javax.swing.text.*;
  30 import javax.swing.plaf.*;
  31 import javax.accessibility.*;
  32 
  33 import java.util.Collections;
  34 import java.util.Set;
  35 import java.util.StringTokenizer;
  36 
  37 import java.io.ObjectOutputStream;
  38 import java.io.ObjectInputStream;
  39 import java.io.IOException;
  40 
  41 /**
  42  * A <code>JTextArea</code> is a multi-line area that displays plain text.
  43  * It is intended to be a lightweight component that provides source
  44  * compatibility with the <code>java.awt.TextArea</code> class where it can
  45  * reasonably do so.
  46  * You can find information and examples of using all the text components in
  47  * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/text.html">Using Text Components</a>,
  48  * a section in <em>The Java Tutorial.</em>
  49  *
  50  * <p>
  51  * This component has capabilities not found in the
  52  * <code>java.awt.TextArea</code> class.  The superclass should be
  53  * consulted for additional capabilities.
  54  * Alternative multi-line text classes with
  55  * more capabilities are <code>JTextPane</code> and <code>JEditorPane</code>.
  56  * <p>
  57  * The <code>java.awt.TextArea</code> internally handles scrolling.
  58  * <code>JTextArea</code> is different in that it doesn't manage scrolling,
  59  * but implements the swing <code>Scrollable</code> interface.  This allows it
  60  * to be placed inside a <code>JScrollPane</code> if scrolling
  61  * behavior is desired, and used directly if scrolling is not desired.
  62  * <p>
  63  * The <code>java.awt.TextArea</code> has the ability to do line wrapping.
  64  * This was controlled by the horizontal scrolling policy.  Since
  65  * scrolling is not done by <code>JTextArea</code> directly, backward
  66  * compatibility must be provided another way.  <code>JTextArea</code> has
  67  * a bound property for line wrapping that controls whether or