Java Reference
In-Depth Information
817
΢΢GExercise R18.18. How many methods does the JProgressBar
component have? Be sure to count inherited methods. Look at the Java
documentation.
Additional review exercises are available in WileyPLUS.
PROGRAMMING EXERCISES
΢GExercise P18.1. Write an application with three buttons labeled ȒRedȓ,
ȒGreenȓ, and ȒBlueȓ that changes the background color of a panel in the
center of the frame to red, green, or blue.
΢΢GExercise P18.2. Add icons to the buttons of Exercise P18.1.
΢΢GExercise P18.3. Write a calculator application. Use a grid layout to
arrange buttons for the digits and for the + ɨ ¶ Ö operations. Add a text
field to display the result.
΢GExercise P18.4. Write an application with three radio buttons labeled
ȒRedȓ, ȒGreenȓ, and ȒBlueȓ that changes the background color of a panel
in the center of the frame to red, green, or blue.
΢GExercise P18.5. Write an application with three check boxes labeled
ȒRedȓ, ȒGreenȓ, and ȒBlueȓ that adds a red, green, or blue component to
the the background color of a panel in the center of the frame. This
application can display a total of eight color combinations.
΢GExercise P18.6. Write an application with a combo box containing three
items labeled ȒRedȓ, ȒGreenȓ, and ȒBlueȓ that changes the background
color of a panel in the center of the frame to red, green, or blue.
΢GExercise P18.7. Write an application with a Color menu and menu items
labeled ȒRedȓ, ȒGreenȓ, and ȒBlueȓ that changes the background color of a
panel in the center of the frame to red, green, or blue.
΢GExercise P18.8. Write a program that displays a number of rectangles at
random positions. Supply buttons ȒFewerȓ and ȒMoreȓ that generate fewer
or more random rectangles. Each time the user clicks on ȒFewerȓ, the
Search WWH ::




Custom Search