52 * <p>
53 * Sliders can also print text labels at regular intervals (or at
54 * arbitrary locations) along the slider track. Painting of labels is
55 * controlled by {@code setLabelTable} and {@code setPaintLabels}.
56 * <p>
57 * For further information and examples see
58 * <a
59 href="https://docs.oracle.com/javase/tutorial/uiswing/components/slider.html">How to Use Sliders</a>,
60 * a section in <em>The Java Tutorial.</em>
61 * <p>
62 * <strong>Warning:</strong> Swing is not thread safe. For more
63 * information see <a
64 * href="package-summary.html#threading">Swing's Threading
65 * Policy</a>.
66 * <p>
67 * <strong>Warning:</strong>
68 * Serialized objects of this class will not be compatible with
69 * future Swing releases. The current serialization support is
70 * appropriate for short term storage or RMI between applications running
71 * the same version of Swing. As of 1.4, support for long term storage
72 * of all JavaBeans™
73 * has been added to the <code>java.beans</code> package.
74 * Please see {@link java.beans.XMLEncoder}.
75 *
76 * @author David Kloba
77 * @since 1.2
78 */
79 @JavaBean(defaultProperty = "UI", description = "A component that supports selecting a integer value from a range.")
80 @SwingContainer(false)
81 @SuppressWarnings("serial") // Same-version serialization only
82 public class JSlider extends JComponent implements SwingConstants, Accessible {
83 /**
84 * @see #getUIClassID
85 * @see #readObject
86 */
87 private static final String uiClassID = "SliderUI";
88
89 private boolean paintTicks = false;
90 private boolean paintTrack = true;
91 private boolean paintLabels = false;
92 private boolean isInverted = false;
1390 * AccessibleContext of this JSlider
1391 */
1392 @BeanProperty(bound = false)
1393 public AccessibleContext getAccessibleContext() {
1394 if (accessibleContext == null) {
1395 accessibleContext = new AccessibleJSlider();
1396 }
1397 return accessibleContext;
1398 }
1399
1400 /**
1401 * This class implements accessibility support for the
1402 * <code>JSlider</code> class. It provides an implementation of the
1403 * Java Accessibility API appropriate to slider user-interface elements.
1404 * <p>
1405 * <strong>Warning:</strong>
1406 * Serialized objects of this class will not be compatible with
1407 * future Swing releases. The current serialization support is
1408 * appropriate for short term storage or RMI between applications running
1409 * the same version of Swing. As of 1.4, support for long term storage
1410 * of all JavaBeans™
1411 * has been added to the <code>java.beans</code> package.
1412 * Please see {@link java.beans.XMLEncoder}.
1413 */
1414 @SuppressWarnings("serial") // Same-version serialization only
1415 protected class AccessibleJSlider extends AccessibleJComponent
1416 implements AccessibleValue {
1417
1418 /**
1419 * Get the state set of this object.
1420 *
1421 * @return an instance of AccessibleState containing the current state
1422 * of the object
1423 * @see AccessibleState
1424 */
1425 public AccessibleStateSet getAccessibleStateSet() {
1426 AccessibleStateSet states = super.getAccessibleStateSet();
1427 if (getValueIsAdjusting()) {
1428 states.add(AccessibleState.BUSY);
1429 }
1430 if (getOrientation() == VERTICAL) {
|
52 * <p>
53 * Sliders can also print text labels at regular intervals (or at
54 * arbitrary locations) along the slider track. Painting of labels is
55 * controlled by {@code setLabelTable} and {@code setPaintLabels}.
56 * <p>
57 * For further information and examples see
58 * <a
59 href="https://docs.oracle.com/javase/tutorial/uiswing/components/slider.html">How to Use Sliders</a>,
60 * a section in <em>The Java Tutorial.</em>
61 * <p>
62 * <strong>Warning:</strong> Swing is not thread safe. For more
63 * information see <a
64 * href="package-summary.html#threading">Swing's Threading
65 * Policy</a>.
66 * <p>
67 * <strong>Warning:</strong>
68 * Serialized objects of this class will not be compatible with
69 * future Swing releases. The current serialization support is
70 * appropriate for short term storage or RMI between applications running
71 * the same version of Swing. As of 1.4, support for long term storage
72 * of all JavaBeans
73 * has been added to the <code>java.beans</code> package.
74 * Please see {@link java.beans.XMLEncoder}.
75 *
76 * @author David Kloba
77 * @since 1.2
78 */
79 @JavaBean(defaultProperty = "UI", description = "A component that supports selecting a integer value from a range.")
80 @SwingContainer(false)
81 @SuppressWarnings("serial") // Same-version serialization only
82 public class JSlider extends JComponent implements SwingConstants, Accessible {
83 /**
84 * @see #getUIClassID
85 * @see #readObject
86 */
87 private static final String uiClassID = "SliderUI";
88
89 private boolean paintTicks = false;
90 private boolean paintTrack = true;
91 private boolean paintLabels = false;
92 private boolean isInverted = false;
1390 * AccessibleContext of this JSlider
1391 */
1392 @BeanProperty(bound = false)
1393 public AccessibleContext getAccessibleContext() {
1394 if (accessibleContext == null) {
1395 accessibleContext = new AccessibleJSlider();
1396 }
1397 return accessibleContext;
1398 }
1399
1400 /**
1401 * This class implements accessibility support for the
1402 * <code>JSlider</code> class. It provides an implementation of the
1403 * Java Accessibility API appropriate to slider user-interface elements.
1404 * <p>
1405 * <strong>Warning:</strong>
1406 * Serialized objects of this class will not be compatible with
1407 * future Swing releases. The current serialization support is
1408 * appropriate for short term storage or RMI between applications running
1409 * the same version of Swing. As of 1.4, support for long term storage
1410 * of all JavaBeans
1411 * has been added to the <code>java.beans</code> package.
1412 * Please see {@link java.beans.XMLEncoder}.
1413 */
1414 @SuppressWarnings("serial") // Same-version serialization only
1415 protected class AccessibleJSlider extends AccessibleJComponent
1416 implements AccessibleValue {
1417
1418 /**
1419 * Get the state set of this object.
1420 *
1421 * @return an instance of AccessibleState containing the current state
1422 * of the object
1423 * @see AccessibleState
1424 */
1425 public AccessibleStateSet getAccessibleStateSet() {
1426 AccessibleStateSet states = super.getAccessibleStateSet();
1427 if (getValueIsAdjusting()) {
1428 states.add(AccessibleState.BUSY);
1429 }
1430 if (getOrientation() == VERTICAL) {
|