ptg7068951
Workshop 217
Q&A
Q. Do you need to do anything with the paint()method or repaint()to
indicate that a text field has been changed?
A. After the setText()method of a text component is used to change its
value,you don’t need to do anything else. Swing handles the updating
necessary to show the new value.
Q. Why do you often import a class and also one of its subclasses,as in
Listing 15.1 when you import java.awt.*andjava.awt.event.*?
Could the first of these statements include the second?
A. Though the names of the java.awtandjava.awt.eventpackages look
like they are related,there’s no such thing as inheritance for packages
in Java. One package cannot be a subpackage of another.
When you use an asterisk in an importstatement,you are making all
the classes in a package available in a program.
The asterisk only works on classes,not packages. The most a single
importstatement can load is the classes of a single package.
Q. Why is the actor Michael J. Fox identified by his middle initial?
A. There already was a Michael Fox in the Screen Actor’s Guild,forcing the
futureFamily TiesandBack to the Futurestar to choose another name
for his professional work. Michael Andrew Fox is his real name,but he
didn’t like the sound of Andrew or Andy Fox and Michael A. Fox sounded
like he was admiring his own good looks.
He settled on Michael J. Fox as an homage to the character actor
Michael J. Pollard.
The other Michael Fox was an actor who appeared on episodes of Perry
Mason,Burke’s Law, and numerous other TV shows and movies until his
death in 1996.
Workshop
After the LottoMadnessprogram has soured you on games of chance,play a
game of skill by answering the following questions.