javax.swing
Class JSlider

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JSlider
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable, SwingConstants
public class JSlider
extends JComponent
implements SwingConstants, Accessible

A component that lets the user graphically select a value by sliding a knob within a bounded interval. The slider can show both major tick marks and minor tick marks between them. The number of values between the tick marks is controlled with setMajorTickSpacing and setMinorTickSpacing.

For further information and examples see How to Use Sliders, a section in The Java Tutorial. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JSlider key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.

 

Nested Class Summary

protected  class JSlider.AccessibleJSlider
    This class implements accessibility support for the JSlider class.
 
Nested classes inherited from class javax.swing.JComponent
 
Nested classes inherited from class java.awt.Container
 
Nested classes inherited from class java.awt.Component
Component.BltBufferStrategy, Component.FlipBufferStrategy
 

 

Field Summary

protected  ChangeEvent changeEvent
    Only one ChangeEvent is needed per slider instance since the event's only (read-only) state is the source property.
protected  ChangeListener changeListener
    The changeListener (no suffix) is the listener we add to the Sliders model.
protected  int majorTickSpacing
    The number of values between the major tick marks -- the larger marks that break up the minor tick marks.
protected  int minorTickSpacing
    The number of values between the minor tick marks -- the smaller marks that occur between the major tick marks.
protected  int orientation
    
protected  BoundedRangeModel sliderModel
    The data model that handles the numeric maximum value, minimum value, and current-position value for the slider.
protected  boolean snapToTicks
    If true, the knob (and the data value it represents) resolve to the closest tick mark next to where the user positioned the knob.
 
Fields inherited from class javax.swing.JComponent
accessibleContext,