aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/awt/Label.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/awt/Label.java')
-rw-r--r--libjava/java/awt/Label.java70
1 files changed, 67 insertions, 3 deletions
diff --git a/libjava/java/awt/Label.java b/libjava/java/awt/Label.java
index 37ff4ec..189bc10 100644
--- a/libjava/java/awt/Label.java
+++ b/libjava/java/awt/Label.java
@@ -1,5 +1,5 @@
/* Label.java -- Java label widget
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,14 +39,18 @@ exception statement from your version. */
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
{
@@ -240,7 +244,7 @@ addNotify()
/**
* Returns a parameter string useful for debugging.
*
- * @param A debugging string.
+ * @return A debugging string.
*/
protected String
paramString()
@@ -249,5 +253,65 @@ paramString()
getAlignment() + "," + super.paramString());
}
+/**
+ * This class provides accessibility support for the label.
+ */
+protected class AccessibleAWTLabel
+ extends AccessibleAWTComponent
+{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = -3568967560160480438L;
+
+ /**
+ * 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