Java Reference
In-Depth Information
14 {
15 /**
16
Constructs the user interface of the ATM frame.
17 */
18
public
ATMFrame(ATM anATM)
19 {
20 theATM = anATM;
21
22//
Construct components
23 pad =
new
KeyPad();
24
25 display =
new
JTextArea(
4
,
20
);
26
27 aButton =
new
JButton(
Ð A Ñ
);
28 aButton.addActionListener(
new
AButtonListener());
29
30 bButton =
new
JButton(
Ð B Ñ
);
31 bButton.addActionListener(
new
BButtonListener());
32
33 cButton =
new
JButton(
Ð C Ñ
);
34 cButton.addActionListener(
new
CButtonListener());
35
36//
Add components
37
38 JPanel buttonPanel =
new
JPanel();
39 buttonPanel.add(aButton);
40 buttonPanel.add(bButton);
41 buttonPanel.add(cButton);
42
43 setLayout(
new
FlowLayout());
44 add(pad);
45 add(display);
46 add(buttonPanel);
47 showState();
48
49 setSize(FRAME_WIDTH, FRAME_HEIGHT);
50 }
51
52 /**
572
573