Java Reference
In-Depth Information
20 */
21 public class FontViewerFrame extends JFrame
22 {
23 /**
24 Constructs the frame.
25 */
26 public FontViewerFrame()
27 {
28 // Construct text sample
29 sampleField = new JLabel( ÐBig JavaÑ );
30 add(sampleField, BorderLayout.CENTER);
31
32 // This listener is shared among all
components
33 class ChoiceListener implements
ActionListener
34 {
35 public void
actionPerformed(ActionEvent event)
36 {
37 setSampleFont();
38 }
39 }
40
41 listener = new ChoiceListener();
42
43 createControlPanel();
44 setSampleFont();
45 setSize(FRAME_WIDTH, FRAME_HEIGHT);
46 }
47
48 /**
49 Creates the control panel to change the
font.
50 */
51 public void createControlPanel()
52 {
53 JPanel facenamePanel = createComboBox();
54 JPanel sizeGroupPanel =
createCheckBoxes();
55 JPanel styleGroupPanel =
createRadioButtons();
56
795
796
Search WWH ::




Custom Search