From 8f523f3a1047919d3563daf1ef47ba87336ebe89 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 15 Nov 2005 23:20:01 +0000 Subject: Imported GNU Classpath 0.19 + gcj-import-20051115. * sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. From-SVN: r107049 --- libjava/classpath/javax/swing/JTextArea.java | 61 ++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) (limited to 'libjava/classpath/javax/swing/JTextArea.java') diff --git a/libjava/classpath/javax/swing/JTextArea.java b/libjava/classpath/javax/swing/JTextArea.java index 53591ff..2fa185b 100644 --- a/libjava/classpath/javax/swing/JTextArea.java +++ b/libjava/classpath/javax/swing/JTextArea.java @@ -42,6 +42,8 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Rectangle; +import javax.accessibility.AccessibleContext; +import javax.accessibility.AccessibleStateSet; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.Element; @@ -92,6 +94,35 @@ import javax.swing.text.View; public class JTextArea extends JTextComponent { /** + * Provides accessibility support for JTextArea. + * + * @author Roman Kennke (kennke@aicas.com) + */ + protected class AccessibleJTextArea extends AccessibleJTextComponent + { + + /** + * Creates a new AccessibleJTextArea object. + */ + protected AccessibleJTextArea() + { + super(); + } + + /** + * Returns the accessible state of this AccessibleJTextArea. + * + * @return the accessible state of this AccessibleJTextArea + */ + public AccessibleStateSet getAccessibleStateSet() + { + AccessibleStateSet state = super.getAccessibleStateSet(); + // TODO: Figure out what state must be added here to the super's state. + return state; + } + } + + /** * Compatible with Sun's JDK */ private static final long serialVersionUID = -6141680179310439825L; @@ -208,6 +239,8 @@ public class JTextArea extends JTextComponent /* This shouldn't happen in theory -- but, if it does... */ throw new RuntimeException("Unexpected exception occurred.", exception); } + if (toAppend != null && toAppend.length() > 0) + revalidate(); } /** @@ -312,8 +345,12 @@ public class JTextArea extends JTextComponent { if (columns < 0) throw new IllegalArgumentException(); - - this.columns = columns; + + if (columns != this.columns) + { + this.columns = columns; + revalidate(); + } } /** @@ -337,8 +374,12 @@ public class JTextArea extends JTextComponent { if (rows < 0) throw new IllegalArgumentException(); - - this.rows = rows; + + if (rows != this.rows) + { + this.rows = rows; + revalidate(); + } } /** @@ -547,4 +588,16 @@ public class JTextArea extends JTextComponent return new Dimension(Math.max(reqWidth, neededWidth), Math.max(reqHeight, neededHeight)); } + + /** + * Returns the accessible context associated with the JTextArea. + * + * @return the accessible context associated with the JTextArea + */ + public AccessibleContext getAccessibleContext() + { + if (accessibleContext == null) + accessibleContext = new AccessibleJTextArea(); + return accessibleContext; + } } -- cgit v1.1