Page 776 - Introduction to Programming with Java: A Problem Solving Approach
P. 776

                742
Chapter 17 GUI Programming—Component Layout, Additional GUI Components
13. 14.
[after §17.14] The JCheckBox, JRadioButton, and JComboBox components are defined in what package?
[after §17.14] Provide a createContents method for a program that initially displays this window:
When the user clicks the left combo box, this displays:
The male and female radio buttons should behave in the normal fashion—when one is selected, the other is unselected. Note that the male button is selected when the window initially displays. Your createContents method must work in conjunction with this program skeleton:
import javax.swing.*;
import java.awt.*;
public class MaleFemaleRadioButtons extends JFrame
{
}
// end class MaleFemaleRadioButtons
private JRadioButton male;
private JRadioButton female;
public MaleFemaleRadioButtons()
{
setTitle("Male-Female Radio Buttons");
setSize(275, 100);
setDefaultCloseOperation(EXIT_ON_CLOSE);
createContents();
setVisible(true);
// end MaleFemaleRadioButtons constructor
<The createContents method goes here.>
public static void main(String[] args)
}
{
}
new MaleFemaleRadioButtons();
Apago PDF Enhancer
  When the user clicks the right combo box, this displays:




































































   774   775   776   777   778