12.9 Sliders
The Slider control is capable of displaying a set of continuous values along a horizontal or vertical line, called a track. The user "slides" the knob, called the thumb, along the track to select a value from the set. To illustrate the Slider control, we create an application that allows the user to control the level of gray in a photo. A gray color is created when the red, green, and blue components have the same value. Each color component’s value can range from 0.0 to 1.0.
Figure 12.11 shows the GUI when the application begins. The top photo is the original version of the image; this may look familiar as the sushi.jpg photo from the ComboBox example in the last section. The lower photo has been converted to a middle level of ...
Get Java Illuminated, 5th Edition 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.