Java Reference
In-Depth Information
Figure 12-8.
JSlider under different look and feel types
Two look-and-feel-related properties are part of the
JSlider
class definition. By default,
the minimum slider value for a horizontal slider is at the left; for a vertical slider, it's at the
bottom. To change the direction of a slider, call the
public void setInverted(boolean newValue)
method with an argument of
true
. In addition, the track that the slider moves along is displayed
by default. You can turn it off with the
public void setPaintTrack(boolean newValue)
method.
A value of
false
turns off the track display. Figure 12-9 identifies the
JSlider
track and points
out the minimum and maximum positions of regular and inverted sliders.
Figure 12-9.
Identifying JSlider positions and tracks