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

Print this page

        

*** 23,43 **** * questions. */ package javax.swing; import java.awt.*; ! import java.awt.event.*; 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 --- 23,38 ---- * questions. */ package javax.swing; import java.awt.*; ! import java.beans.JavaBean; ! import java.beans.BeanProperty; import javax.swing.text.*; import javax.accessibility.*; import java.io.ObjectOutputStream; 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,132 **** * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; * 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 */ @SuppressWarnings("serial") // Same-version serialization only public class JTextArea extends JTextComponent { /** * @see #getUIClassID --- 109,125 ---- * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @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,244 **** --- 228,238 ---- * * @return the ID ("TextAreaUI") * @see JComponent#getUIClassID * @see UIDefaults#getUI */ + @BeanProperty(bound = false) public String getUIClassID() { return uiClassID; } /**
*** 258,272 **** * 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 */ public void setTabSize(int size) { Document doc = getDocument(); if (doc != null) { int old = getTabSize(); doc.putProperty(PlainDocument.tabSizeAttribute, Integer.valueOf(size)); --- 252,264 ---- * variable width fonts. A PropertyChange event ("tabSize") is fired * when the tab size changes. * * @param size number of characters to expand to * @see #getTabSize */ + @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,314 **** * 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 */ public void setLineWrap(boolean wrap) { boolean old = this.wrap; this.wrap = wrap; firePropertyChange("lineWrap", old, wrap); } --- 292,304 ---- * 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 */ + @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,348 **** * 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 */ public void setWrapStyleWord(boolean word) { boolean old = this.word; this.word = word; firePropertyChange("wrapStyleWord", old, word); } --- 324,336 ---- * By default this property is false. * * @param word indicates if word boundaries should be used * for line wrapping * @see #getWrapStyleWord */ + @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,395 **** --- 374,384 ---- /** * Determines the number of lines contained in the area. * * @return the number of lines &gt; 0 */ + @BeanProperty(bound = false) public int getLineCount() { Element map = getDocument().getDefaultRootElement(); return map.getElementCount(); }
*** 529,541 **** * setting the new value. * * @param rows the number of rows &gt;= 0 * @exception IllegalArgumentException if rows is less than 0 * @see #getRows - * @beaninfo - * 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."); } --- 518,530 ---- * setting the new value. * * @param rows the number of rows &gt;= 0 * @exception IllegalArgumentException if rows is less than 0 * @see #getRows */ + @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."); }
*** 573,585 **** * after setting the new value. * * @param columns the number of columns &gt;= 0 * @exception IllegalArgumentException if columns is less than 0 * @see #getColumns - * @beaninfo - * 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."); } --- 562,574 ---- * after setting the new value. * * @param columns the number of columns &gt;= 0 * @exception IllegalArgumentException if columns is less than 0 * @see #getColumns */ + @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."); }
*** 678,687 **** --- 667,677 ---- * 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(); } /**
*** 691,700 **** --- 681,691 ---- * 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();
*** 764,773 **** --- 755,765 ---- * 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;