JSlider Class
Package: javax.swing
The JSlider
class creates a slider control, which lets a user pick a value from a set range (say, from 0 to 50) by moving a knob. A slider is a convenient way to get numeric input from the user when the input falls within a set range of values. Figure 5-10 shows a typical slider.
Figure 5-10
Constructors
Constructor |
Description |
|
Creates a new slider. The minimum and maximum values default to |
|
Creates a new slider with the specified minimum and maximum values. The initial value is halfway between the minimum and maximum. |
|
Creates a new slider with the specified minimum, maximum, and initial values. |
|
Creates a new slider with the specified minimum, maximum, and initial values. The orientation can be |
Methods
Method |
Description |
|
Adds a |
|
Gets the value indicated by the current position of the knob. |
|
Sets the font of the text associated with the slider. |
|
If |
Get Java For Dummies Quick Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.