jdk/src/share/classes/javax/swing/JTextArea.java
Print this page
@@ -23,21 +23,16 @@
* questions.
*/
package javax.swing;
import java.awt.*;
-import java.awt.event.*;
+import java.beans.JavaBean;
+import java.beans.BeanProperty;
import javax.swing.text.*;
-import javax.swing.plaf.*;
import javax.accessibility.*;
-import java.util.Collections;
-import java.util.Set;
-import java.util.StringTokenizer;
-
import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
import java.io.IOException;
/**
* A <code>JTextArea</code> is a multi-line area that displays plain text.
* It is intended to be a lightweight component that provides source
@@ -114,19 +109,17 @@
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
- * @beaninfo
- * attribute: isContainer false
- * description: A multi-line area that displays plain text.
- *
* @author Timothy Prinzing
* @see JTextPane
* @see JEditorPane
* @since 1.2
*/
+@JavaBean(defaultProperty = "UIClassID", description = "A multi-line area that displays plain text.")
+@SwingContainer(false)
@SuppressWarnings("serial") // Same-version serialization only
public class JTextArea extends JTextComponent {
/**
* @see #getUIClassID
@@ -235,10 +228,11 @@
*
* @return the ID ("TextAreaUI")
* @see JComponent#getUIClassID
* @see UIDefaults#getUI
*/
+ @BeanProperty(bound = false)
public String getUIClassID() {
return uiClassID;
}
/**
@@ -258,15 +252,13 @@
* variable width fonts. A PropertyChange event ("tabSize") is fired
* when the tab size changes.
*
* @param size number of characters to expand to
* @see #getTabSize
- * @beaninfo
- * preferred: true
- * bound: true
- * description: the number of characters to expand tabs to
*/
+ @BeanProperty(preferred = true, description
+ = "the number of characters to expand tabs to")
public void setTabSize(int size) {
Document doc = getDocument();
if (doc != null) {
int old = getTabSize();
doc.putProperty(PlainDocument.tabSizeAttribute, Integer.valueOf(size));
@@ -300,15 +292,13 @@
* event ("lineWrap") is fired when the policy is changed.
* By default this property is false.
*
* @param wrap indicates if lines should be wrapped
* @see #getLineWrap
- * @beaninfo
- * preferred: true
- * bound: true
- * description: should lines be wrapped
*/
+ @BeanProperty(preferred = true, description
+ = "should lines be wrapped")
public void setLineWrap(boolean wrap) {
boolean old = this.wrap;
this.wrap = wrap;
firePropertyChange("lineWrap", old, wrap);
}
@@ -334,15 +324,13 @@
* By default this property is false.
*
* @param word indicates if word boundaries should be used
* for line wrapping
* @see #getWrapStyleWord
- * @beaninfo
- * preferred: false
- * bound: true
- * description: should wrapping occur at word boundaries
*/
+ @BeanProperty(description
+ = "should wrapping occur at word boundaries")
public void setWrapStyleWord(boolean word) {
boolean old = this.word;
this.word = word;
firePropertyChange("wrapStyleWord", old, word);
}
@@ -386,10 +374,11 @@
/**
* Determines the number of lines contained in the area.
*
* @return the number of lines > 0
*/
+ @BeanProperty(bound = false)
public int getLineCount() {
Element map = getDocument().getDefaultRootElement();
return map.getElementCount();
}
@@ -530,13 +519,13 @@
* setting the new value.
*
* @param rows the number of rows >= 0
* @exception IllegalArgumentException if rows is less than 0
* @see #getRows
- * @beaninfo
- * description: the number of rows preferred for display
*/
+ @BeanProperty(bound = false, description
+ = "the number of rows preferred for display")
public void setRows(int rows) {
int oldVal = this.rows;
if (rows < 0) {
throw new IllegalArgumentException("rows less than zero.");
}
@@ -574,13 +563,13 @@
* after setting the new value.
*
* @param columns the number of columns >= 0
* @exception IllegalArgumentException if columns is less than 0
* @see #getColumns
- * @beaninfo
- * description: the number of columns preferred for display
*/
+ @BeanProperty(bound = false, description
+ = "the number of columns preferred for display")
public void setColumns(int columns) {
int oldVal = this.columns;
if (columns < 0) {
throw new IllegalArgumentException("columns less than zero.");
}
@@ -679,10 +668,11 @@
* if lines are not being wrapped.
*
* @return true if a viewport should force the Scrollables width
* to match its own.
*/
+ @BeanProperty(bound = false)
public boolean getScrollableTracksViewportWidth() {
return (wrap) ? true : super.getScrollableTracksViewportWidth();
}
/**
@@ -692,10 +682,11 @@
* behavior is used.
*
* @return The preferredSize of a JViewport whose view is this Scrollable.
* @see JViewport#getPreferredSize
*/
+ @BeanProperty(bound = false)
public Dimension getPreferredScrollableViewportSize() {
Dimension size = super.getPreferredScrollableViewportSize();
size = (size == null) ? new Dimension(400,400) : size;
Insets insets = getInsets();
@@ -765,10 +756,11 @@
* A new AccessibleJTextArea instance is created if necessary.
*
* @return an AccessibleJTextArea that serves as the
* AccessibleContext of this JTextArea
*/
+ @BeanProperty(bound = false)
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJTextArea();
}
return accessibleContext;