Page 726 - Introduction to Programming with Java: A Problem Solving Approach
P. 726
692 Chapter 16 GUI Programming Basics
11. If a class is limited in scope such that it is only needed internally within another class, you should define the
class to be an inner class.
12. The argument to give to the addActionListener method to register an anonymous listener class is:
new ActionListener()
{
}
<implementation-of-ActionListener-interface>
13. The object that calls the add methods is a JFrame object.
14. It's ambiguous. It could be either xBox or btn.
15. The package that contains the JOptionPane class is the javax.swing package.
16. This code generates the asked-for dialog box:
JOptionPane.showMessageDialog(null,
"This is only a test.", "TEST", JOptionPane.PLAIN_MESSAGE);
17. To identify the firing component, call the getSource method.
18. buttonLabel = action.getActionCommand();
19. button1.setForeground(Color.BLUE);
20. Call JFrame’s getContentPane method.
21. False. The java.awt and java.awt.event packages contain separate classes. To import classes from java.awt.event, you musAt ipmpaortgthoat pacPkaDge FexplicEitlynlihkeathins: cer
import java.awt.event.*;