aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/JScrollBar.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
committerMark Wielaard <mark@gcc.gnu.org>2006-05-18 17:29:21 +0000
commit4f9533c7722fa07511a94d005227961f4a4dec23 (patch)
tree9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/javax/swing/JScrollBar.java
parenteaec4980e139903ae9b274d1abcf3a13946603a8 (diff)
downloadgcc-4f9533c7722fa07511a94d005227961f4a4dec23.zip
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.gz
gcc-4f9533c7722fa07511a94d005227961f4a4dec23.tar.bz2
Imported GNU Classpath 0.90
Imported GNU Classpath 0.90 * scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. From-SVN: r113887
Diffstat (limited to 'libjava/classpath/javax/swing/JScrollBar.java')
-rw-r--r--libjava/classpath/javax/swing/JScrollBar.java84
1 files changed, 54 insertions, 30 deletions
diff --git a/libjava/classpath/javax/swing/JScrollBar.java b/libjava/classpath/javax/swing/JScrollBar.java
index a2cc76c..bca2468 100644
--- a/libjava/classpath/javax/swing/JScrollBar.java
+++ b/libjava/classpath/javax/swing/JScrollBar.java
@@ -1,5 +1,5 @@
/* JScrollBar.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,10 +42,12 @@ import java.awt.Adjustable;
import java.awt.Dimension;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
+import java.beans.PropertyChangeEvent;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
import javax.accessibility.AccessibleValue;
import javax.swing.plaf.ScrollBarUI;
@@ -60,7 +62,8 @@ import javax.swing.plaf.ScrollBarUI;
public class JScrollBar extends JComponent implements Adjustable, Accessible
{
/**
- * DOCUMENT ME!
+ * Provides the accessibility features for the <code>JScrollBar</code>
+ * component.
*/
protected class AccessibleJScrollBar extends JComponent.AccessibleJComponent
implements AccessibleValue
@@ -68,7 +71,7 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
private static final long serialVersionUID = -7758162392045586663L;
/**
- * Creates a new AccessibleJSlider object.
+ * Creates a new <code>AccessibleJScrollBar</code> instance.
*/
protected AccessibleJScrollBar()
{
@@ -76,75 +79,96 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
}
/**
- * DOCUMENT ME!
+ * Returns a set containing the current state of the {@link JScrollBar}
+ * component.
*
- * @return DOCUMENT ME!
+ * @return The accessible state set.
*/
public AccessibleStateSet getAccessibleStateSet()
{
- return null;
+ AccessibleStateSet result = super.getAccessibleStateSet();
+ if (orientation == JScrollBar.HORIZONTAL)
+ result.add(AccessibleState.HORIZONTAL);
+ else if (orientation == JScrollBar.VERTICAL)
+ result.add(AccessibleState.VERTICAL);
+ return result;
}
/**
- * DOCUMENT ME!
+ * Returns the accessible role for the <code>JScrollBar</code> component.
*
- * @return DOCUMENT ME!
+ * @return {@link AccessibleRole#SCROLL_BAR}.
*/
public AccessibleRole getAccessibleRole()
{
- return null;
+ return AccessibleRole.SCROLL_BAR;
}
/**
- * DOCUMENT ME!
+ * Returns an object that provides access to the current, minimum and
+ * maximum values.
*
- * @return DOCUMENT ME!
+ * @return The accessible value.
*/
public AccessibleValue getAccessibleValue()
{
- return null;
+ return this;
}
/**
- * DOCUMENT ME!
+ * Returns the current value of the {@link JScrollBar} component, as an
+ * {@link Integer}.
*
- * @return DOCUMENT ME!
+ * @return The current value of the {@link JScrollBar} component.
*/
public Number getCurrentAccessibleValue()
{
- return null;
+ return new Integer(getValue());
}
/**
- * setCurrentAccessibleValue
+ * Sets the current value of the {@link JScrollBar} component and sends a
+ * {@link PropertyChangeEvent} (with the property name
+ * {@link AccessibleContext#ACCESSIBLE_VALUE_PROPERTY}) to all registered
+ * listeners. If the supplied value is <code>null</code>, this method
+ * does nothing and returns <code>false</code>.
*
- * @param value0 TODO
+ * @param value the new slider value (<code>null</code> permitted).
*
- * @return boolean
+ * @return <code>true</code> if the slider value is updated, and
+ * <code>false</code> otherwise.
*/
- public boolean setCurrentAccessibleValue(Number value0)
+ public boolean setCurrentAccessibleValue(Number value)
{
- return false;
+ if (value == null)
+ return false;
+ Number oldValue = getCurrentAccessibleValue();
+ setValue(value.intValue());
+ firePropertyChange(AccessibleContext.ACCESSIBLE_VALUE_PROPERTY, oldValue,
+ new Integer(getValue()));
+ return true;
}
/**
- * getMinimumAccessibleValue
+ * Returns the minimum value of the {@link JScrollBar} component, as an
+ * {@link Integer}.
*
- * @return Number
+ * @return The minimum value of the {@link JScrollBar} component.
*/
public Number getMinimumAccessibleValue()
{
- return null;
+ return new Integer(getMinimum());
}
/**
- * getMaximumAccessibleValue
+ * Returns the maximum value of the {@link JScrollBar} component, as an
+ * {@link Integer}.
*
- * @return Number
+ * @return The maximum value of the {@link JScrollBar} component.
*/
public Number getMaximumAccessibleValue()
{
- return null;
+ return new Integer(getMaximum() - model.getExtent());
}
}
@@ -233,8 +257,6 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
public void updateUI()
{
setUI((ScrollBarUI) UIManager.getUI(this));
- invalidate();
- repaint();
}
/**
@@ -632,9 +654,11 @@ public class JScrollBar extends JComponent implements Adjustable, Accessible
}
/**
- * DOCUMENT ME!
+ * Returns the object that provides accessibility features for this
+ * <code>JScrollBar</code> component.
*
- * @return DOCUMENT ME!
+ * @return The accessible context (an instance of
+ * {@link AccessibleJScrollBar}).
*/
public AccessibleContext getAccessibleContext()
{