< prev index next >

src/java.desktop/share/classes/java/awt/TextArea.java

Print this page

        

@@ -33,11 +33,11 @@
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleState;
 import javax.accessibility.AccessibleStateSet;
 
 /**
- * A <code>TextArea</code> object is a multi-line region
+ * A {@code TextArea} object is a multi-line region
  * that displays text. It can be set to allow editing or
  * to be read-only.
  * <p>
  * The following image shows the appearance of a text area:
  * <p>

@@ -54,22 +54,22 @@
  * @since       1.0
  */
 public class TextArea extends TextComponent {
 
     /**
-     * The number of rows in the <code>TextArea</code>.
+     * The number of rows in the {@code TextArea}.
      * This parameter will determine the text area's height.
      * Guaranteed to be non-negative.
      *
      * @serial
      * @see #getRows()
      * @see #setRows(int)
      */
     int rows;
 
     /**
-     * The number of columns in the <code>TextArea</code>.
+     * The number of columns in the {@code TextArea}.
      * A column is an approximate average character
      * width that is platform-dependent.
      * This parameter will determine the text area's width.
      * Guaranteed to be non-negative.
      *

@@ -107,14 +107,14 @@
     public static final int SCROLLBARS_NONE = 3;
 
     /**
      * Determines which scrollbars are created for the
      * text area. It can be one of four values :
-     * <code>SCROLLBARS_BOTH</code> = both scrollbars.<BR>
-     * <code>SCROLLBARS_HORIZONTAL_ONLY</code> = Horizontal bar only.<BR>
-     * <code>SCROLLBARS_VERTICAL_ONLY</code> = Vertical bar only.<BR>
-     * <code>SCROLLBARS_NONE</code> = No scrollbars.<BR>
+     * {@code SCROLLBARS_BOTH} = both scrollbars.<BR>
+     * {@code SCROLLBARS_HORIZONTAL_ONLY} = Horizontal bar only.<BR>
+     * {@code SCROLLBARS_VERTICAL_ONLY} = Vertical bar only.<BR>
+     * {@code SCROLLBARS_NONE} = No scrollbars.<BR>
      *
      * @serial
      * @see #getScrollbarVisibility()
      */
     private int scrollbarVisibility;

@@ -153,11 +153,11 @@
      * Constructs a new text area with the empty string as text.
      * This text area is created with scrollbar visibility equal to
      * {@link #SCROLLBARS_BOTH}, so both vertical and horizontal
      * scrollbars will be visible for this text area.
      * @exception HeadlessException if
-     *    <code>GraphicsEnvironment.isHeadless</code> returns true
+     *    {@code GraphicsEnvironment.isHeadless} returns true
      * @see java.awt.GraphicsEnvironment#isHeadless()
      */
     public TextArea() throws HeadlessException {
         this("", 0, 0, SCROLLBARS_BOTH);
     }

@@ -166,14 +166,14 @@
      * Constructs a new text area with the specified text.
      * This text area is created with scrollbar visibility equal to
      * {@link #SCROLLBARS_BOTH}, so both vertical and horizontal
      * scrollbars will be visible for this text area.
      * @param      text       the text to be displayed; if
-     *             <code>text</code> is <code>null</code>, the empty
-     *             string <code>""</code> will be displayed
+     *             {@code text} is {@code null}, the empty
+     *             string {@code ""} will be displayed
      * @exception HeadlessException if
-     *        <code>GraphicsEnvironment.isHeadless</code> returns true
+     *        {@code GraphicsEnvironment.isHeadless} returns true
      * @see java.awt.GraphicsEnvironment#isHeadless()
      */
     public TextArea(String text) throws HeadlessException {
         this(text, 0, 0, SCROLLBARS_BOTH);
     }

@@ -187,11 +187,11 @@
      * vertical and horizontal scrollbars will be visible for this
      * text area.
      * @param rows the number of rows
      * @param columns the number of columns
      * @exception HeadlessException if
-     *     <code>GraphicsEnvironment.isHeadless</code> returns true
+     *     {@code GraphicsEnvironment.isHeadless} returns true
      * @see java.awt.GraphicsEnvironment#isHeadless()
      */
     public TextArea(int rows, int columns) throws HeadlessException {
         this("", rows, columns, SCROLLBARS_BOTH);
     }

@@ -203,56 +203,56 @@
      * width that is platform-dependent.  The text area is created with
      * scrollbar visibility equal to {@link #SCROLLBARS_BOTH}, so both
      * vertical and horizontal scrollbars will be visible for this
      * text area.
      * @param      text       the text to be displayed; if
-     *             <code>text</code> is <code>null</code>, the empty
-     *             string <code>""</code> will be displayed
+     *             {@code text} is {@code null}, the empty
+     *             string {@code ""} will be displayed
      * @param     rows      the number of rows
      * @param     columns   the number of columns
      * @exception HeadlessException if
-     *   <code>GraphicsEnvironment.isHeadless</code> returns true
+     *   {@code GraphicsEnvironment.isHeadless} returns true
      * @see java.awt.GraphicsEnvironment#isHeadless()
      */
     public TextArea(String text, int rows, int columns)
         throws HeadlessException {
         this(text, rows, columns, SCROLLBARS_BOTH);
     }
 
     /**
      * Constructs a new text area with the specified text,
      * and with the rows, columns, and scroll bar visibility
-     * as specified.  All <code>TextArea</code> constructors defer to
+     * as specified.  All {@code TextArea} constructors defer to
      * this one.
      * <p>
-     * The <code>TextArea</code> class defines several constants
+     * The {@code TextArea} class defines several constants
      * that can be supplied as values for the
-     * <code>scrollbars</code> argument:
+     * {@code scrollbars} argument:
      * <ul>
-     * <li><code>SCROLLBARS_BOTH</code>,
-     * <li><code>SCROLLBARS_VERTICAL_ONLY</code>,
-     * <li><code>SCROLLBARS_HORIZONTAL_ONLY</code>,
-     * <li><code>SCROLLBARS_NONE</code>.
+     * <li>{@code SCROLLBARS_BOTH},
+     * <li>{@code SCROLLBARS_VERTICAL_ONLY},
+     * <li>{@code SCROLLBARS_HORIZONTAL_ONLY},
+     * <li>{@code SCROLLBARS_NONE}.
      * </ul>
      * Any other value for the
-     * <code>scrollbars</code> argument is invalid and will result in
+     * {@code scrollbars} argument is invalid and will result in
      * this text area being created with scrollbar visibility equal to
      * the default value of {@link #SCROLLBARS_BOTH}.
      * @param      text       the text to be displayed; if
-     *             <code>text</code> is <code>null</code>, the empty
-     *             string <code>""</code> will be displayed
+     *             {@code text} is {@code null}, the empty
+     *             string {@code ""} will be displayed
      * @param      rows       the number of rows; if
-     *             <code>rows</code> is less than <code>0</code>,
-     *             <code>rows</code> is set to <code>0</code>
+     *             {@code rows} is less than {@code 0},
+     *             {@code rows} is set to {@code 0}
      * @param      columns    the number of columns; if
-     *             <code>columns</code> is less than <code>0</code>,
-     *             <code>columns</code> is set to <code>0</code>
+     *             {@code columns} is less than {@code 0},
+     *             {@code columns} is set to {@code 0}
      * @param      scrollbars  a constant that determines what
      *             scrollbars are created to view the text area
      * @since      1.1
      * @exception HeadlessException if
-     *    <code>GraphicsEnvironment.isHeadless</code> returns true
+     *    {@code GraphicsEnvironment.isHeadless} returns true
      * @see java.awt.GraphicsEnvironment#isHeadless()
      */
     public TextArea(String text, int rows, int columns, int scrollbars)
         throws HeadlessException {
         super(text);

@@ -271,22 +271,22 @@
         setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
                               backwardTraversalKeys);
     }
 
     /**
-     * Construct a name for this component.  Called by <code>getName</code>
-     * when the name is <code>null</code>.
+     * Construct a name for this component.  Called by {@code getName}
+     * when the name is {@code null}.
      */
     String constructComponentName() {
         synchronized (TextArea.class) {
             return base + nameCounter++;
         }
     }
 
     /**
-     * Creates the <code>TextArea</code>'s peer.  The peer allows us to modify
-     * the appearance of the <code>TextArea</code> without changing any of its
+     * Creates the {@code TextArea}'s peer.  The peer allows us to modify
+     * the appearance of the {@code TextArea} without changing any of its
      * functionality.
      */
     public void addNotify() {
         synchronized (getTreeLock()) {
             if (peer == null)

@@ -296,15 +296,15 @@
     }
 
     /**
      * Inserts the specified text at the specified position
      * in this text area.
-     * <p>Note that passing <code>null</code> or inconsistent
+     * <p>Note that passing {@code null} or inconsistent
      * parameters is invalid and will result in unspecified
      * behavior.
      *
-     * @param      str the non-<code>null</code> text to insert
+     * @param      str the non-{@code null} text to insert
      * @param      pos the position at which to insert
      * @see        java.awt.TextComponent#setText
      * @see        java.awt.TextArea#replaceRange
      * @see        java.awt.TextArea#append
      * @since      1.1

@@ -318,11 +318,11 @@
      * in this text area.
      *
      * @param  str the non-{@code null} text to insert
      * @param  pos the position at which to insert
      * @deprecated As of JDK version 1.1,
-     * replaced by <code>insert(String, int)</code>.
+     * replaced by {@code insert(String, int)}.
      */
     @Deprecated
     public synchronized void insertText(String str, int pos) {
         TextAreaPeer peer = (TextAreaPeer)this.peer;
         if (peer != null) {

@@ -331,15 +331,15 @@
         text = text.substring(0, pos) + str + text.substring(pos);
     }
 
     /**
      * Appends the given text to the text area's current text.
-     * <p>Note that passing <code>null</code> or inconsistent
+     * <p>Note that passing {@code null} or inconsistent
      * parameters is invalid and will result in unspecified
      * behavior.
      *
-     * @param     str the non-<code>null</code> text to append
+     * @param     str the non-{@code null} text to append
      * @see       java.awt.TextArea#insert
      * @since     1.1
      */
     public void append(String str) {
         appendText(str);

@@ -348,11 +348,11 @@
     /**
      * Appends the given text to the text area's current text.
      *
      * @param  str the text to append
      * @deprecated As of JDK version 1.1,
-     * replaced by <code>append(String)</code>.
+     * replaced by {@code append(String)}.
      */
     @Deprecated
     public synchronized void appendText(String str) {
             insertText(str, getText().length());
     }

@@ -363,15 +363,15 @@
      * position will not be replaced.  The text at the start
      * position will be replaced (unless the start position is the
      * same as the end position).
      * The text position is zero-based.  The inserted substring may be
      * of a different length than the text it replaces.
-     * <p>Note that passing <code>null</code> or inconsistent
+     * <p>Note that passing {@code null} or inconsistent
      * parameters is invalid and will result in unspecified
      * behavior.
      *
-     * @param     str      the non-<code>null</code> text to use as
+     * @param     str      the non-{@code null} text to use as
      *                     the replacement
      * @param     start    the start position
      * @param     end      the end position
      * @see       java.awt.TextArea#insert
      * @since     1.1

@@ -389,11 +389,11 @@
      * @param  str the non-{@code null} text to use as
      *         the replacement
      * @param  start the start position
      * @param  end the end position
      * @deprecated As of JDK version 1.1,
-     * replaced by <code>replaceRange(String, int, int)</code>.
+     * replaced by {@code replaceRange(String, int, int)}.
      */
     @Deprecated
     public synchronized void replaceText(String str, int start, int end) {
         TextAreaPeer peer = (TextAreaPeer)this.peer;
         if (peer != null) {

@@ -417,12 +417,12 @@
      * Sets the number of rows for this text area.
      * @param       rows   the number of rows
      * @see         #getRows()
      * @see         #setColumns(int)
      * @exception   IllegalArgumentException   if the value
-     *                 supplied for <code>rows</code>
-     *                 is less than <code>0</code>
+     *                 supplied for {@code rows}
+     *                 is less than {@code 0}
      * @since       1.1
      */
     public void setRows(int rows) {
         int oldVal = this.rows;
         if (rows < 0) {

@@ -448,12 +448,12 @@
      * Sets the number of columns for this text area.
      * @param       columns   the number of columns
      * @see         #getColumns()
      * @see         #setRows(int)
      * @exception   IllegalArgumentException   if the value
-     *                 supplied for <code>columns</code>
-     *                 is less than <code>0</code>
+     *                 supplied for {@code columns}
+     *                 is less than {@code 0}
      * @since       1.1
      */
     public void setColumns(int columns) {
         int oldVal = this.columns;
         if (columns < 0) {

@@ -467,13 +467,13 @@
 
     /**
      * Returns an enumerated value that indicates which scroll bars
      * the text area uses.
      * <p>
-     * The <code>TextArea</code> class defines four integer constants
+     * The {@code TextArea} class defines four integer constants
      * that are used to specify which scroll bars are available.
-     * <code>TextArea</code> has one constructor that gives the
+     * {@code TextArea} has one constructor that gives the
      * application discretion over scroll bars.
      *
      * @return     an integer that indicates which scroll bars are used
      * @see        java.awt.TextArea#SCROLLBARS_BOTH
      * @see        java.awt.TextArea#SCROLLBARS_VERTICAL_ONLY

@@ -508,11 +508,11 @@
      *
      * @param  rows the number of rows
      * @param  columns the number of columns
      * @return the preferred dimensions needed for the text area
      * @deprecated As of JDK version 1.1,
-     * replaced by <code>getPreferredSize(int, int)</code>.
+     * replaced by {@code getPreferredSize(int, int)}.
      */
     @Deprecated
     public Dimension preferredSize(int rows, int columns) {
         synchronized (getTreeLock()) {
             TextAreaPeer peer = (TextAreaPeer)this.peer;

@@ -532,11 +532,11 @@
         return preferredSize();
     }
 
     /**
      * @deprecated As of JDK version 1.1,
-     * replaced by <code>getPreferredSize()</code>.
+     * replaced by {@code getPreferredSize()}.
      */
     @Deprecated
     public Dimension preferredSize() {
         synchronized (getTreeLock()) {
             return ((rows > 0) && (columns > 0)) ?

@@ -566,11 +566,11 @@
      *
      * @param  rows the number of rows
      * @param  columns the number of columns
      * @return the minimum size for the text area
      * @deprecated As of JDK version 1.1,
-     * replaced by <code>getMinimumSize(int, int)</code>.
+     * replaced by {@code getMinimumSize(int, int)}.
      */
     @Deprecated
     public Dimension minimumSize(int rows, int columns) {
         synchronized (getTreeLock()) {
             TextAreaPeer peer = (TextAreaPeer)this.peer;

@@ -590,11 +590,11 @@
         return minimumSize();
     }
 
     /**
      * @deprecated As of JDK version 1.1,
-     * replaced by <code>getMinimumSize()</code>.
+     * replaced by {@code getMinimumSize()}.
      */
     @Deprecated
     public Dimension minimumSize() {
         synchronized (getTreeLock()) {
             return ((rows > 0) && (columns > 0)) ?

@@ -602,15 +602,15 @@
                         super.minimumSize();
         }
     }
 
     /**
-     * Returns a string representing the state of this <code>TextArea</code>.
+     * Returns a string representing the state of this {@code TextArea}.
      * This method is intended to be used only for debugging purposes, and the
      * content and format of the returned string may vary between
      * implementations. The returned string may be empty but may not be
-     * <code>null</code>.
+     * {@code null}.
      *
      * @return      the parameter string of this text area
      */
     protected String paramString() {
         String sbVisStr;

@@ -648,12 +648,12 @@
     private int textAreaSerializedDataVersion = 2;
 
     /**
      * Read the ObjectInputStream.
      * @exception HeadlessException if
-     * <code>GraphicsEnvironment.isHeadless()</code> returns
-     * <code>true</code>
+     * {@code GraphicsEnvironment.isHeadless()} returns
+     * {@code true}
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
     private void readObject(ObjectInputStream s)
       throws ClassNotFoundException, IOException, HeadlessException
     {

@@ -687,18 +687,18 @@
 // Accessibility support
 ////////////////
 
 
     /**
-     * Returns the <code>AccessibleContext</code> associated with
-     * this <code>TextArea</code>. For text areas, the
-     * <code>AccessibleContext</code> takes the form of an
-     * <code>AccessibleAWTTextArea</code>.
-     * A new <code>AccessibleAWTTextArea</code> instance is created if necessary.
+     * Returns the {@code AccessibleContext} associated with
+     * this {@code TextArea}. For text areas, the
+     * {@code AccessibleContext} takes the form of an
+     * {@code AccessibleAWTTextArea}.
+     * A new {@code AccessibleAWTTextArea} instance is created if necessary.
      *
-     * @return an <code>AccessibleAWTTextArea</code> that serves as the
-     *         <code>AccessibleContext</code> of this <code>TextArea</code>
+     * @return an {@code AccessibleAWTTextArea} that serves as the
+     *         {@code AccessibleContext} of this {@code TextArea}
      * @since 1.3
      */
     public AccessibleContext getAccessibleContext() {
         if (accessibleContext == null) {
             accessibleContext = new AccessibleAWTTextArea();

@@ -706,11 +706,11 @@
         return accessibleContext;
     }
 
     /**
      * This class implements accessibility support for the
-     * <code>TextArea</code> class.  It provides an implementation of the
+     * {@code TextArea} class.  It provides an implementation of the
      * Java Accessibility API appropriate to text area user-interface elements.
      * @since 1.3
      */
     protected class AccessibleAWTTextArea extends AccessibleAWTTextComponent
     {
< prev index next >