Chapter 15: More Widgets
The exercises here are taken from my forthcoming book
The Java Developer's Resource.
- What would happen if you tried to set more than one Checkbox in a CheckboxGroup to true initially?
- Write a Headline Component which implements the same methods as java.awt.Label but draws all text in 24 point Helvetica bold.
- Add two constructors to the PanicButton class. One that takes no arguments and produces a PanicButton with a fifty pixel radius, and one that takes an int and produces a PanicButton with that size radius.
- Write a CircleButton class that creates a circular button as a subclass of Canvas. It should allow (but not require) the creator to specify the label and the radius of the button. Furthermore it should post an action event if the mouse is pressed and released inside the circle.
- Add getLabel and setLabel methods to the PanicButton class. If the size of the button was not specified at creation time, adjust the minimum size of the button to be large enough for the text in the current font.
- Add setColor, setTextColor and setFont methods to the CircleButton. You now have a fairly generic circular button.
[ Exercises | Cafe Au Lait |
Trade Shows |
Links | FAQ |
User Groups ]
Copyright 1996 Elliotte Rusty Harold
Last Modified August 20, 1996