Solutions to other chapters:
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  
Java Methods Home Page Skylight Publishing



Java Methods A & AB:
Object-Oriented Programming and Data Structures

Answers and Solutions to Exercises

Chapter 16

1.  

JPanel        none               none
JLabel        none               none
JButton       ActionListener     none
JCheckBox     \ ActionListener   isSelected
JRadioButton  |      or          isSelected
JComboBox     / ItemListener     getSelectedIndex or getSelectedItem
JTextField    ActionListener     getText
JSlider       ChangeListener     getValue
JMenuItem     ActionListener     none
2. (a) T -- why not? It's a regular method.
(b) T -- this object's class must implement both ActionListener and ItemListener interfaces and must supply actionPerformed and itemStateChanged methods.
(c) T -- then all of their respective actionPerformed methods are called.
7.   See JM\Ch16\Exercises\Solutions\PizzaGui.java.

Copyright © 2006 by Skylight Publishing