0N/A/*
2362N/A * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/Apackage java.awt;
0N/A
0N/Aimport java.awt.event.InputEvent;
0N/Aimport java.awt.event.KeyEvent;
0N/Aimport java.awt.peer.TextAreaPeer;
0N/Aimport java.io.ObjectOutputStream;
0N/Aimport java.io.ObjectInputStream;
0N/Aimport java.io.IOException;
0N/Aimport java.util.HashSet;
0N/Aimport java.util.Set;
0N/Aimport javax.accessibility.*;
0N/A
0N/A/**
0N/A * A <code>TextArea</code> object is a multi-line region
0N/A * that displays text. It can be set to allow editing or
0N/A * to be read-only.
0N/A * <p>
0N/A * The following image shows the appearance of a text area:
0N/A * <p>
0N/A * <img src="doc-files/TextArea-1.gif" alt="A TextArea showing the word 'Hello!'"
0N/A * ALIGN=center HSPACE=10 VSPACE=7>
0N/A * <p>
0N/A * This text area could be created by the following line of code:
0N/A * <p>
0N/A * <hr><blockquote><pre>
0N/A * new TextArea("Hello", 5, 40);
0N/A * </pre></blockquote><hr>
0N/A * <p>
0N/A * @author Sami Shaio
0N/A * @since JDK1.0
0N/A */
0N/Apublic class TextArea extends TextComponent {
0N/A
0N/A /**
0N/A * The number of rows in the <code>TextArea</code>.
0N/A * This parameter will determine the text area's height.
0N/A * Guaranteed to be non-negative.
0N/A *
0N/A * @serial
0N/A * @see #getRows()
0N/A * @see #setRows(int)
0N/A */
0N/A int rows;
0N/A
0N/A /**
0N/A * The number of columns in the <code>TextArea</code>.
0N/A * A column is an approximate average character
0N/A * width that is platform-dependent.
0N/A * This parameter will determine the text area's width.
0N/A * Guaranteed to be non-negative.
0N/A *
0N/A * @serial
0N/A * @see #setColumns(int)
0N/A * @see #getColumns()
0N/A */
0N/A int columns;
0N/A
0N/A private static final String base = "text";
0N/A private static int nameCounter = 0;
0N/A
0N/A /**
0N/A * Create and display both vertical and horizontal scrollbars.
0N/A * @since JDK1.1
0N/A */
0N/A public static final int SCROLLBARS_BOTH = 0;
0N/A
0N/A /**
0N/A * Create and display vertical scrollbar only.
0N/A * @since JDK1.1
0N/A */
0N/A public static final int SCROLLBARS_VERTICAL_ONLY = 1;
0N/A
0N/A /**
0N/A * Create and display horizontal scrollbar only.
0N/A * @since JDK1.1
0N/A */
0N/A public static final int SCROLLBARS_HORIZONTAL_ONLY = 2;
0N/A
0N/A /**
0N/A * Do not create or display any scrollbars for the text area.
0N/A * @since JDK1.1
0N/A */
0N/A public static final int SCROLLBARS_NONE = 3;
0N/A
0N/A /**
0N/A * Determines which scrollbars are created for the
0N/A * text area. It can be one of four values :
0N/A * <code>SCROLLBARS_BOTH</code> = both scrollbars.<BR>
0N/A * <code>SCROLLBARS_HORIZONTAL_ONLY</code> = Horizontal bar only.<BR>
0N/A * <code>SCROLLBARS_VERTICAL_ONLY</code> = Vertical bar only.<BR>
0N/A * <code>SCROLLBARS_NONE</code> = No scrollbars.<BR>
0N/A *
0N/A * @serial
0N/A * @see #getScrollbarVisibility()
0N/A */
0N/A private int scrollbarVisibility;
0N/A
0N/A /**
0N/A * Cache the Sets of forward and backward traversal keys so we need not
0N/A * look them up each time.
0N/A */
0N/A private static Set forwardTraversalKeys, backwardTraversalKeys;
0N/A
0N/A /*
0N/A * JDK 1.1 serialVersionUID
0N/A */
0N/A private static final long serialVersionUID = 3692302836626095722L;
0N/A
0N/A /**
0N/A * Initialize JNI field and method ids
0N/A */
0N/A private static native void initIDs();
0N/A
0N/A static {
0N/A /* ensure that the necessary native libraries are loaded */
0N/A Toolkit.loadLibraries();
0N/A if (!GraphicsEnvironment.isHeadless()) {
0N/A initIDs();
0N/A }
0N/A forwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet(
0N/A "ctrl TAB",
0N/A new HashSet());
0N/A backwardTraversalKeys = KeyboardFocusManager.initFocusTraversalKeysSet(
0N/A "ctrl shift TAB",
0N/A new HashSet());
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new text area with the empty string as text.
0N/A * This text area is created with scrollbar visibility equal to
0N/A * {@link #SCROLLBARS_BOTH}, so both vertical and horizontal
0N/A * scrollbars will be visible for this text area.
0N/A * @exception HeadlessException if
0N/A * <code>GraphicsEnvironment.isHeadless</code> returns true
0N/A * @see java.awt.GraphicsEnvironment#isHeadless()
0N/A */
0N/A public TextArea() throws HeadlessException {
0N/A this("", 0, 0, SCROLLBARS_BOTH);
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new text area with the specified text.
0N/A * This text area is created with scrollbar visibility equal to
0N/A * {@link #SCROLLBARS_BOTH}, so both vertical and horizontal
0N/A * scrollbars will be visible for this text area.
0N/A * @param text the text to be displayed; if
0N/A * <code>text</code> is <code>null</code>, the empty
0N/A * string <code>""</code> will be displayed
0N/A * @exception HeadlessException if
0N/A * <code>GraphicsEnvironment.isHeadless</code> returns true
0N/A * @see java.awt.GraphicsEnvironment#isHeadless()
0N/A */
0N/A public TextArea(String text) throws HeadlessException {
0N/A this(text, 0, 0, SCROLLBARS_BOTH);
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new text area with the specified number of
0N/A * rows and columns and the empty string as text.
0N/A * A column is an approximate average character
0N/A * width that is platform-dependent. The text area is created with
0N/A * scrollbar visibility equal to {@link #SCROLLBARS_BOTH}, so both
0N/A * vertical and horizontal scrollbars will be visible for this
0N/A * text area.
0N/A * @param rows the number of rows
0N/A * @param columns the number of columns
0N/A * @exception HeadlessException if
0N/A * <code>GraphicsEnvironment.isHeadless</code> returns true
0N/A * @see java.awt.GraphicsEnvironment#isHeadless()
0N/A */
0N/A public TextArea(int rows, int columns) throws HeadlessException {
0N/A this("", rows, columns, SCROLLBARS_BOTH);
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new text area with the specified text,
0N/A * and with the specified number of rows and columns.
0N/A * A column is an approximate average character
0N/A * width that is platform-dependent. The text area is created with
0N/A * scrollbar visibility equal to {@link #SCROLLBARS_BOTH}, so both
0N/A * vertical and horizontal scrollbars will be visible for this
0N/A * text area.
0N/A * @param text the text to be displayed; if
0N/A * <code>text</code> is <code>null</code>, the empty
0N/A * string <code>""</code> will be displayed
0N/A * @param rows the number of rows
0N/A * @param columns the number of columns
0N/A * @exception HeadlessException if
0N/A * <code>GraphicsEnvironment.isHeadless</code> returns true
0N/A * @see java.awt.GraphicsEnvironment#isHeadless()
0N/A */
0N/A public TextArea(String text, int rows, int columns)
0N/A throws HeadlessException {
0N/A this(text, rows, columns, SCROLLBARS_BOTH);
0N/A }
0N/A
0N/A /**
0N/A * Constructs a new text area with the specified text,
0N/A * and with the rows, columns, and scroll bar visibility
0N/A * as specified. All <code>TextArea</code> constructors defer to
0N/A * this one.
0N/A * <p>
0N/A * The <code>TextArea</code> class defines several constants
0N/A * that can be supplied as values for the
0N/A * <code>scrollbars</code> argument:
0N/A * <ul>
0N/A * <li><code>SCROLLBARS_BOTH</code>,
0N/A * <li><code>SCROLLBARS_VERTICAL_ONLY</code>,
0N/A * <li><code>SCROLLBARS_HORIZONTAL_ONLY</code>,
0N/A * <li><code>SCROLLBARS_NONE</code>.
0N/A * </ul>
0N/A * Any other value for the
0N/A * <code>scrollbars</code> argument is invalid and will result in
0N/A * this text area being created with scrollbar visibility equal to
0N/A * the default value of {@link #SCROLLBARS_BOTH}.
0N/A * @param text the text to be displayed; if
0N/A * <code>text</code> is <code>null</code>, the empty
0N/A * string <code>""</code> will be displayed
0N/A * @param rows the number of rows; if
0N/A * <code>rows</code> is less than <code>0</code>,
0N/A * <code>rows</code> is set to <code>0</code>
0N/A * @param columns the number of columns; if
0N/A * <code>columns</code> is less than <code>0</code>,
0N/A * <code>columns</code> is set to <code>0</code>
0N/A * @param scrollbars a constant that determines what
0N/A * scrollbars are created to view the text area
0N/A * @since JDK1.1
0N/A * @exception HeadlessException if
0N/A * <code>GraphicsEnvironment.isHeadless</code> returns true
0N/A * @see java.awt.GraphicsEnvironment#isHeadless()
0N/A */
0N/A public TextArea(String text, int rows, int columns, int scrollbars)
0N/A throws HeadlessException {
0N/A super(text);
0N/A
0N/A this.rows = (rows >= 0) ? rows : 0;
0N/A this.columns = (columns >= 0) ? columns : 0;
0N/A
0N/A if (scrollbars >= SCROLLBARS_BOTH && scrollbars <= SCROLLBARS_NONE) {
0N/A this.scrollbarVisibility = scrollbars;
0N/A } else {
0N/A this.scrollbarVisibility = SCROLLBARS_BOTH;
0N/A }
0N/A
0N/A setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
0N/A forwardTraversalKeys);
0N/A setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
0N/A backwardTraversalKeys);
0N/A }
0N/A
0N/A /**
0N/A * Construct a name for this component. Called by <code>getName</code>
0N/A * when the name is <code>null</code>.
0N/A */
0N/A String constructComponentName() {
0N/A synchronized (TextArea.class) {
0N/A return base + nameCounter++;
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Creates the <code>TextArea</code>'s peer. The peer allows us to modify
0N/A * the appearance of the <code>TextArea</code> without changing any of its
0N/A * functionality.
0N/A */
0N/A public void addNotify() {
0N/A synchronized (getTreeLock()) {
0N/A if (peer == null)
0N/A peer = getToolkit().createTextArea(this);
0N/A super.addNotify();
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Inserts the specified text at the specified position
0N/A * in this text area.
0N/A * <p>Note that passing <code>null</code> or inconsistent
0N/A * parameters is invalid and will result in unspecified
0N/A * behavior.
0N/A *
0N/A * @param str the non-<code>null</code> text to insert
0N/A * @param pos the position at which to insert
0N/A * @see java.awt.TextComponent#setText
0N/A * @see java.awt.TextArea#replaceRange
0N/A * @see java.awt.TextArea#append
0N/A * @since JDK1.1
0N/A */
0N/A public void insert(String str, int pos) {
0N/A insertText(str, pos);
0N/A }
0N/A
0N/A /**
0N/A * @deprecated As of JDK version 1.1,
0N/A * replaced by <code>insert(String, int)</code>.
0N/A */
0N/A @Deprecated
0N/A public synchronized void insertText(String str, int pos) {
0N/A TextAreaPeer peer = (TextAreaPeer)this.peer;
0N/A if (peer != null) {
872N/A peer.insert(str, pos);
0N/A } else {
0N/A text = text.substring(0, pos) + str + text.substring(pos);
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Appends the given text to the text area's current text.
0N/A * <p>Note that passing <code>null</code> or inconsistent
0N/A * parameters is invalid and will result in unspecified
0N/A * behavior.
0N/A *
0N/A * @param str the non-<code>null</code> text to append
0N/A * @see java.awt.TextArea#insert
0N/A * @since JDK1.1
0N/A */
0N/A public void append(String str) {
0N/A appendText(str);
0N/A }
0N/A
0N/A /**
0N/A * @deprecated As of JDK version 1.1,
0N/A * replaced by <code>append(String)</code>.
0N/A */
0N/A @Deprecated
0N/A public synchronized void appendText(String str) {
0N/A if (peer != null) {
0N/A insertText(str, getText().length());
0N/A } else {
0N/A text = text + str;
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Replaces text between the indicated start and end positions
0N/A * with the specified replacement text. The text at the end
0N/A * position will not be replaced. The text at the start
0N/A * position will be replaced (unless the start position is the
0N/A * same as the end position).
0N/A * The text position is zero-based. The inserted substring may be
0N/A * of a different length than the text it replaces.
0N/A * <p>Note that passing <code>null</code> or inconsistent
0N/A * parameters is invalid and will result in unspecified
0N/A * behavior.
0N/A *
0N/A * @param str the non-<code>null</code> text to use as
0N/A * the replacement
0N/A * @param start the start position
0N/A * @param end the end position
0N/A * @see java.awt.TextArea#insert
0N/A * @since JDK1.1
0N/A */
0N/A public void replaceRange(String str, int start, int end) {
0N/A replaceText(str, start, end);
0N/A }
0N/A
0N/A /**
0N/A * @deprecated As of JDK version 1.1,
0N/A * replaced by <code>replaceRange(String, int, int)</code>.
0N/A */
0N/A @Deprecated
0N/A public synchronized void replaceText(String str, int start, int end) {
0N/A TextAreaPeer peer = (TextAreaPeer)this.peer;
0N/A if (peer != null) {
872N/A peer.replaceRange(str, start, end);
0N/A } else {
0N/A text = text.substring(0, start) + str + text.substring(end);
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Returns the number of rows in the text area.
0N/A * @return the number of rows in the text area
0N/A * @see #setRows(int)
0N/A * @see #getColumns()
0N/A * @since JDK1
0N/A */
0N/A public int getRows() {
0N/A return rows;
0N/A }
0N/A
0N/A /**
0N/A * Sets the number of rows for this text area.
0N/A * @param rows the number of rows
0N/A * @see #getRows()
0N/A * @see #setColumns(int)
0N/A * @exception IllegalArgumentException if the value
0N/A * supplied for <code>rows</code>
0N/A * is less than <code>0</code>
0N/A * @since JDK1.1
0N/A */
0N/A public void setRows(int rows) {
0N/A int oldVal = this.rows;
0N/A if (rows < 0) {
0N/A throw new IllegalArgumentException("rows less than zero.");
0N/A }
0N/A if (rows != oldVal) {
0N/A this.rows = rows;
0N/A invalidate();
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Returns the number of columns in this text area.
0N/A * @return the number of columns in the text area
0N/A * @see #setColumns(int)
0N/A * @see #getRows()
0N/A */
0N/A public int getColumns() {
0N/A return columns;
0N/A }
0N/A
0N/A /**
0N/A * Sets the number of columns for this text area.
0N/A * @param columns the number of columns
0N/A * @see #getColumns()
0N/A * @see #setRows(int)
0N/A * @exception IllegalArgumentException if the value
0N/A * supplied for <code>columns</code>
0N/A * is less than <code>0</code>
0N/A * @since JDK1.1
0N/A */
0N/A public void setColumns(int columns) {
0N/A int oldVal = this.columns;
0N/A if (columns < 0) {
0N/A throw new IllegalArgumentException("columns less than zero.");
0N/A }
0N/A if (columns != oldVal) {
0N/A this.columns = columns;
0N/A invalidate();
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Returns an enumerated value that indicates which scroll bars
0N/A * the text area uses.
0N/A * <p>
0N/A * The <code>TextArea</code> class defines four integer constants
0N/A * that are used to specify which scroll bars are available.
0N/A * <code>TextArea</code> has one constructor that gives the
0N/A * application discretion over scroll bars.
0N/A *
0N/A * @return an integer that indicates which scroll bars are used
0N/A * @see java.awt.TextArea#SCROLLBARS_BOTH
0N/A * @see java.awt.TextArea#SCROLLBARS_VERTICAL_ONLY
0N/A * @see java.awt.TextArea#SCROLLBARS_HORIZONTAL_ONLY
0N/A * @see java.awt.TextArea#SCROLLBARS_NONE
0N/A * @see java.awt.TextArea#TextArea(java.lang.String, int, int, int)
0N/A * @since JDK1.1
0N/A */
0N/A public int getScrollbarVisibility() {
0N/A return scrollbarVisibility;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Determines the preferred size of a text area with the specified
0N/A * number of rows and columns.
0N/A * @param rows the number of rows
0N/A * @param columns the number of columns
0N/A * @return the preferred dimensions required to display
0N/A * the text area with the specified
0N/A * number of rows and columns
0N/A * @see java.awt.Component#getPreferredSize
0N/A * @since JDK1.1
0N/A */
0N/A public Dimension getPreferredSize(int rows, int columns) {
0N/A return preferredSize(rows, columns);
0N/A }
0N/A
0N/A /**
0N/A * @deprecated As of JDK version 1.1,
0N/A * replaced by <code>getPreferredSize(int, int)</code>.
0N/A */
0N/A @Deprecated
0N/A public Dimension preferredSize(int rows, int columns) {
0N/A synchronized (getTreeLock()) {
0N/A TextAreaPeer peer = (TextAreaPeer)this.peer;
0N/A return (peer != null) ?
872N/A peer.getPreferredSize(rows, columns) :
0N/A super.preferredSize();
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Determines the preferred size of this text area.
0N/A * @return the preferred dimensions needed for this text area
0N/A * @see java.awt.Component#getPreferredSize
0N/A * @since JDK1.1
0N/A */
0N/A public Dimension getPreferredSize() {
0N/A return preferredSize();
0N/A }
0N/A
0N/A /**
0N/A * @deprecated As of JDK version 1.1,
0N/A * replaced by <code>getPreferredSize()</code>.
0N/A */
0N/A @Deprecated
0N/A public Dimension preferredSize() {
0N/A synchronized (getTreeLock()) {
0N/A return ((rows > 0) && (columns > 0)) ?
0N/A preferredSize(rows, columns) :
0N/A super.preferredSize();
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Determines the minimum size of a text area with the specified
0N/A * number of rows and columns.
0N/A * @param rows the number of rows
0N/A * @param columns the number of columns
0N/A * @return the minimum dimensions required to display
0N/A * the text area with the specified
0N/A * number of rows and columns
0N/A * @see java.awt.Component#getMinimumSize
0N/A * @since JDK1.1
0N/A */
0N/A public Dimension getMinimumSize(int rows, int columns) {
0N/A return minimumSize(rows, columns);
0N/A }
0N/A
0N/A /**
0N/A * @deprecated As of JDK version 1.1,
0N/A * replaced by <code>getMinimumSize(int, int)</code>.
0N/A */
0N/A @Deprecated
0N/A public Dimension minimumSize(int rows, int columns) {
0N/A synchronized (getTreeLock()) {
0N/A TextAreaPeer peer = (TextAreaPeer)this.peer;
0N/A return (peer != null) ?
872N/A peer.getMinimumSize(rows, columns) :
0N/A super.minimumSize();
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Determines the minimum size of this text area.
0N/A * @return the preferred dimensions needed for this text area
0N/A * @see java.awt.Component#getPreferredSize
0N/A * @since JDK1.1
0N/A */
0N/A public Dimension getMinimumSize() {
0N/A return minimumSize();
0N/A }
0N/A
0N/A /**
0N/A * @deprecated As of JDK version 1.1,
0N/A * replaced by <code>getMinimumSize()</code>.
0N/A */
0N/A @Deprecated
0N/A public Dimension minimumSize() {
0N/A synchronized (getTreeLock()) {
0N/A return ((rows > 0) && (columns > 0)) ?
0N/A minimumSize(rows, columns) :
0N/A super.minimumSize();
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Returns a string representing the state of this <code>TextArea</code>.
0N/A * This method is intended to be used only for debugging purposes, and the
0N/A * content and format of the returned string may vary between
0N/A * implementations. The returned string may be empty but may not be
0N/A * <code>null</code>.
0N/A *
0N/A * @return the parameter string of this text area
0N/A */
0N/A protected String paramString() {
0N/A String sbVisStr;
0N/A switch (scrollbarVisibility) {
0N/A case SCROLLBARS_BOTH:
0N/A sbVisStr = "both";
0N/A break;
0N/A case SCROLLBARS_VERTICAL_ONLY:
0N/A sbVisStr = "vertical-only";
0N/A break;
0N/A case SCROLLBARS_HORIZONTAL_ONLY:
0N/A sbVisStr = "horizontal-only";
0N/A break;
0N/A case SCROLLBARS_NONE:
0N/A sbVisStr = "none";
0N/A break;
0N/A default:
0N/A sbVisStr = "invalid display policy";
0N/A }
0N/A
0N/A return super.paramString() + ",rows=" + rows +
0N/A ",columns=" + columns +
0N/A ",scrollbarVisibility=" + sbVisStr;
0N/A }
0N/A
0N/A
0N/A /*
0N/A * Serialization support.
0N/A */
0N/A /**
0N/A * The textArea Serialized Data Version.
0N/A *
0N/A * @serial
0N/A */
0N/A private int textAreaSerializedDataVersion = 2;
0N/A
0N/A /**
0N/A * Read the ObjectInputStream.
0N/A * @exception HeadlessException if
0N/A * <code>GraphicsEnvironment.isHeadless()</code> returns
0N/A * <code>true</code>
0N/A * @see java.awt.GraphicsEnvironment#isHeadless
0N/A */
0N/A private void readObject(ObjectInputStream s)
0N/A throws ClassNotFoundException, IOException, HeadlessException
0N/A {
0N/A // HeadlessException will be thrown by TextComponent's readObject
0N/A s.defaultReadObject();
0N/A
0N/A // Make sure the state we just read in for columns, rows,
0N/A // and scrollbarVisibility has legal values
0N/A if (columns < 0) {
0N/A columns = 0;
0N/A }
0N/A if (rows < 0) {
0N/A rows = 0;
0N/A }
0N/A
0N/A if ((scrollbarVisibility < SCROLLBARS_BOTH) ||
0N/A (scrollbarVisibility > SCROLLBARS_NONE)) {
0N/A this.scrollbarVisibility = SCROLLBARS_BOTH;
0N/A }
0N/A
0N/A if (textAreaSerializedDataVersion < 2) {
0N/A setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
0N/A forwardTraversalKeys);
0N/A setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,
0N/A backwardTraversalKeys);
0N/A }
0N/A }
0N/A
0N/A
0N/A/////////////////
0N/A// Accessibility support
0N/A////////////////
0N/A
0N/A
0N/A /**
0N/A * Returns the <code>AccessibleContext</code> associated with
0N/A * this <code>TextArea</code>. For text areas, the
0N/A * <code>AccessibleContext</code> takes the form of an
0N/A * <code>AccessibleAWTTextArea</code>.
0N/A * A new <code>AccessibleAWTTextArea</code> instance is created if necessary.
0N/A *
0N/A * @return an <code>AccessibleAWTTextArea</code> that serves as the
0N/A * <code>AccessibleContext</code> of this <code>TextArea</code>
0N/A * @since 1.3
0N/A */
0N/A public AccessibleContext getAccessibleContext() {
0N/A if (accessibleContext == null) {
0N/A accessibleContext = new AccessibleAWTTextArea();
0N/A }
0N/A return accessibleContext;
0N/A }
0N/A
0N/A /**
0N/A * This class implements accessibility support for the
0N/A * <code>TextArea</code> class. It provides an implementation of the
0N/A * Java Accessibility API appropriate to text area user-interface elements.
0N/A * @since 1.3
0N/A */
0N/A protected class AccessibleAWTTextArea extends AccessibleAWTTextComponent
0N/A {
0N/A /*
0N/A * JDK 1.3 serialVersionUID
0N/A */
0N/A private static final long serialVersionUID = 3472827823632144419L;
0N/A
0N/A /**
0N/A * Gets the state set of this object.
0N/A *
0N/A * @return an instance of AccessibleStateSet describing the states
0N/A * of the object
0N/A * @see AccessibleStateSet
0N/A */
0N/A public AccessibleStateSet getAccessibleStateSet() {
0N/A AccessibleStateSet states = super.getAccessibleStateSet();
0N/A states.add(AccessibleState.MULTI_LINE);
0N/A return states;
0N/A }
0N/A }
0N/A
0N/A
0N/A}