Java Reference
In-Depth Information
94 italicCheckBox =
new
JCheckBox(
ÐItalicÑ
);
95 italicCheckBox.addActionListener(listener);
96
97 boldCheckBox =
new
JCheckBox(
ÐBoldÑ
);
98 boldCheckBox.addActionListener(listener);
99
100 JPanel panel =
new
JPanel();
101 panel.add(italicCheckBox);
102 panel.add(boldCheckBox);
103 panel.setBorder(
104
new
TitledBorder(
new
EtchedBorder(),
ÐStyleÑ
));
105
106
return
panel;
107 }
108
109 /**
110
Creates the radio buttons to select the
font size.
111 @return
the panel containing the radio
buttons
112 */
113
public
JPanel createRadioButtons()
114 {
115 smallButton =
new
JRadioButton(
ÐSmallÑ
);
116 smallButton.addActionListener(listener);
117
118 mediumButton =
new
JRadioButton(
ÐMediumÑ
);
119 mediumButton.addActionListener(listener);
120
121 largeButton =
new
JRadioButton(
ÐLargeÑ
);
122 largeButton.addActionListener(listener);
123 largeButton.setSelected(
true
);
124
125 //
Add radio buttons to button group
126
127 ButtonGroup group =
new
ButtonGroup();
128 group.add(smallButton);
129 group.add(mediumButton);
130 group.add(largeButton);
131
796
797