Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)

(singke) #1
ptg7068951

Laying Out an Application 195

68:
69: FlowLayout layout3 = new FlowLayout(FlowLayout.CENTER,
70: 10, 10);
71: row3.setLayout(layout3);
72: stop.setEnabled(false);
73: row3.add(stop);
74: row3.add(play);
75: row3.add(reset);
76: add(row3);
77:
78: GridLayout layout4 = new GridLayout(2, 3, 20, 10);
79: row4.setLayout(layout4);
80: row4.add(got3Label);
81: got3.setEditable(false);
82: row4.add(got3);
83: row4.add(got4Label);
84: got4.setEditable(false);
85: row4.add(got4);
86: row4.add(got5Label);
87: got5.setEditable(false);
88: row4.add(got5);
89: row4.add(got6Label);
90: got6.setEditable(false);
91: row4.add(got6);
92: row4.add(drawingsLabel);
93: drawings.setEditable(false);
94: row4.add(drawings);
95: row4.add(yearsLabel);
96: years.setEditable(false);
97: row4.add(years);
98: add(row4);
99:
100: setVisible(true);
101: }
102:
103: private voidsetLookAndFeel() {
104: try {
105: UIManager.setLookAndFeel(
106: “com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel”
107: );
108: } catch(Exception exc) {
109: // ignore error
110: }
111: }
112:
113: public static voidmain(String[] arguments) {
114: LottoMadness frame = new LottoMadness();
115: }
116: }


LISTING 14.2 Continued

Free download pdf