Java Reference
In-Depth Information
57 //
Line up component panels
58
59 JPanel controlPanel =
new
JPanel();
60 controlPanel.setLayout(
new
GridLayout(3, 1));
61 controlPanel.add(facenamePanel);
62 controlPanel.add(sizeGroupPanel);
63 controlPanel.add(styleGroupPanel);
64
65 //
Add panels to content pane
66
67 add(controlPanel, BorderLayout.SOUTH);
68 }
69
70 /**
71
Creates the combo box with the font
style choices.
72 @return
the panel containing the combo
box
73 */
74
public
JPanel createComboBox()
75 {
76 facenameCombo =
new
JComboBox();
77 facenameCombo.addItem(
ÐSerifÑ
);
78 facenameCombo.addItem(
ÐSansSerifÑ
);
79 facenameCombo.addItem(
ÐMonospacedÑ
);
80 facenameCombo.setEditable(
true
);
81 facenameCombo.addActionListener(listener);
82
83 JPanel panel =
new
JPanel();
84 panel.add(facenameCombo);
85
return
panel;
86 }
87
88 /**
89
Creates the check boxes for selecting
bold and italic styles.
90 @return
the panel containing the check
boxes
91 */
92
public
JPanel createCheckBoxes()
93 {