summaryrefslogtreecommitdiff
path: root/java/awt/Label.java
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2004-08-24 19:00:37 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2004-08-24 19:00:37 +0000
commitd0ec2d88e156dd1e52bd1cdaf512f2367b7693a9 (patch)
tree25c347d170b6a2a45d627653d820d5b5d5ccef5e /java/awt/Label.java
parent8f0b2148a9406a079311f5a9c19c65980022fafe (diff)
downloadclasspath-d0ec2d88e156dd1e52bd1cdaf512f2367b7693a9.tar.gz
* java/awt/Label.java, java/awt/Canvas.java
Added accessibility classes to AWT Label and Canvas, as well as additional documentation for Canvas.
Diffstat (limited to 'java/awt/Label.java')
-rw-r--r--java/awt/Label.java60
1 files changed, 59 insertions, 1 deletions
diff --git a/java/awt/Label.java b/java/awt/Label.java
index 37ff4ec5b..0cc92abe4 100644
--- a/java/awt/Label.java
+++ b/java/awt/Label.java
@@ -40,13 +40,16 @@ package java.awt;
import java.awt.peer.LabelPeer;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
/**
* This component is used for displaying simple text strings that cannot
- * be edited.
+ * be edited by the user.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
*/
public class Label extends Component implements Accessible
{
@@ -249,5 +252,60 @@ paramString()
getAlignment() + "," + super.paramString());
}
+/**
+ * This class provides accessibility support for the label.
+ */
+protected class AccessibleAWTLabel
+ extends AccessibleAWTComponent
+{
+ /**
+ * Constructor for the accessible label.
+ */
+ public AccessibleAWTLabel()
+ {
+ }
+
+ /**
+ * Returns the accessible name for the label. This is
+ * the text used in the label.
+ *
+ * @return a <code>String</code> containing the accessible
+ * name for this label.
+ */
+ public String getAccessibleName()
+ {
+ return getText();
+ }
+
+ /**
+ * Returns the accessible role for the label.
+ *
+ * @return an instance of <code>AccessibleRole</code>, describing
+ * the role of the label.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.LABEL;
+ }
+
+}
+
+/**
+ * Gets the AccessibleContext associated with this <code>Label</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+public AccessibleContext getAccessibleContext()
+{
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ {
+ /* Create the context */
+ accessibleContext = new AccessibleAWTLabel();
+ }
+ return accessibleContext;
+}
+
} // class Label