Java Reference
In-Depth Information
Table 12-2. JScrollBar UIResource Elements (Continued)
Property String
Object Type
ScrollBar.thumbShadow
Color
ScrollBar.track
Color
ScrollBar.trackForeground
Color
ScrollBar.trackHighlight
Color
ScrollBar.trackHighlightForeground
Color
ScrollBar.width
Integer
ScrollBarUI
String
JSlider Class
Although the JScrollBar component is useful for scrolling regions of the screen, it's not a good
component for getting user input for a range of values. For that purpose, Swing offers the
JSlider component. In addition to a draggable thumb like the one provided by the JScrollBar
component, the JSlider component offers visible tick marks and labels to assist in showing the
current setting and selecting a new one. Figure 12-5 shows several sample JSlider components.
Figure 12-5. Sample JSlider components
The JSlider is made up of several pieces. The familiar BoundedRangeModel stores the data
model for the component, and a Dictionary stores any labels for the tick marks. The user interface
delegate is the SliderUI .
Now that you've seen the different pieces of a JSlider , let's find out how to use them.
Creating JSlider Components
There are six different constructors for JSlider :
 
Search WWH ::




Custom Search