Java Reference
In-Depth Information
88 }
89 showState();
90 }
91 }
92
93
private class
BButtonListener
implements
ActionListener
94 {
95
public void
actionPerformed(ActionEvent
event)
96 {
97
int
state = theATM.getState();
98
if
(state == ATM.ACCOUNT)
99 theATM.selectAccount(ATM.SAVINGS);
100
else if
(state == ATM.TRANSACT)
101 {
102 theATM.deposit(pad.getValue());
103 theATM.back();
104 }
105 showState();
106 }
107 }
108
109
private class
CButtonListener
implements
ActionListener
110 {
111
public void
actionPerformed(ActionEvent
event)
112 {
113
int
state = theATM.getState();
114
if
(state == ATM.ACCOUNT)
115 theATM.reset();
116
else if
(state == ATM.TRANSACT)
117 theATM.back();
118 showState();
119 }
120 }
121
122
private
JButton aButton;
123
private
JButton bButton;
124
private
JButton cButton;
125
126
private
KeyPad pad;
573
574