aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/JCheckBox.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2005-11-15 23:20:01 +0000
committerMark Wielaard <mark@gcc.gnu.org>2005-11-15 23:20:01 +0000
commit8f523f3a1047919d3563daf1ef47ba87336ebe89 (patch)
treea5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/javax/swing/JCheckBox.java
parent02e549bfaaec38f68307e7f34e46ea57ea1809af (diff)
downloadgcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.zip
gcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.tar.gz
gcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.tar.bz2
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. From-SVN: r107049
Diffstat (limited to 'libjava/classpath/javax/swing/JCheckBox.java')
-rw-r--r--libjava/classpath/javax/swing/JCheckBox.java70
1 files changed, 47 insertions, 23 deletions
diff --git a/libjava/classpath/javax/swing/JCheckBox.java b/libjava/classpath/javax/swing/JCheckBox.java
index a743308..74fda8f 100644
--- a/libjava/classpath/javax/swing/JCheckBox.java
+++ b/libjava/classpath/javax/swing/JCheckBox.java
@@ -38,7 +38,9 @@ exception statement from your version. */
package javax.swing;
+import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
/**
* A small box that displays a check or not, depending on it's
@@ -54,8 +56,32 @@ import javax.accessibility.AccessibleContext;
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class JCheckBox extends JToggleButton
+public class JCheckBox extends JToggleButton implements Accessible
{
+
+ /**
+ * Provides accessibility support for <code>JCheckBox</code>.
+ */
+ protected class AccessibleJCheckBox extends AccessibleJToggleButton
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJCheckBox</code>.
+ */
+ public AccessibleJCheckBox()
+ {
+ // Nothing to do here.
+ }
+
+ /**
+ * Returns the accessble role of <code>JCheckBox</code>,
+ * {@link AccessibleRole#CHECK_BOX}.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.CHECK_BOX;
+ }
+ }
+
private static final long serialVersionUID = -5246739313864538930L;
public static final String BORDER_PAINTED_FLAT_CHANGED_PROPERTY =
@@ -71,61 +97,47 @@ public class JCheckBox extends JToggleButton
public JCheckBox()
{
- super();
- init();
+ this(null, null, false);
}
public JCheckBox(Action action)
{
super(action);
- init();
}
public JCheckBox(Icon icon)
{
- super(icon);
- init();
+ this(null, icon, false);
}
public JCheckBox(Icon icon, boolean selected)
{
- super(icon, selected);
- init();
+ this(null, icon, selected);
}
public JCheckBox(String text)
{
- super(text);
- init();
+ this(text, null, false);
}
public JCheckBox(String text, boolean selected)
{
- super(text, selected);
- init();
+ this(text, null, selected);
}
public JCheckBox(String text, Icon icon)
{
- super(text, icon);
- init();
+ this(text, icon, false);
}
public JCheckBox(String text, Icon icon, boolean selected)
{
super(text, icon, selected);
- init();
+ setHorizontalAlignment(LEADING);
+ setBorderPainted(false);
}
/**
- * Gets the AccessibleContext associated with this JCheckBox.
- */
- public AccessibleContext getAccessibleContext()
- {
- return null;
- }
-
- /**
* Returns a string that specifies the name of the Look and Feel class
* that renders this component.
*/
@@ -149,4 +161,16 @@ public class JCheckBox extends JToggleButton
firePropertyChange("borderPaintedFlat", borderPaintedFlat, newValue);
borderPaintedFlat = newValue;
}
+
+ /**
+ * Returns the accessible context for this <code>JCheckBox</code>.
+ *
+ * @return the accessible context for this <code>JCheckBox</code>
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJCheckBox();
+ return accessibleContext;
+ }
}