October 2011
Beginner
432 pages
10h 18m
English
The easiest way to collect numeric input from a user is with a slider, a component that can be dragged from side to side or up and down. Sliders are represented in Swing by the JSlider class.
Sliders enable a number to be chosen between minimum and maximum values. These values can be displayed on a label that includes the minimum value, maximum value, and intermediate values. An example you create later is shown in Figure 16.2.
Figure 16.2. Choosing a color using three slider components.
You can create a horizontal slider with one of the following constructors:
• JSlider()—Create a slider with a minimum of 0, maximum of 100, and starting ...
Read now
Unlock full access