01: import java.io.IOException;
02: import javax.swing.JFrame;
03: import javax.swing.JOptionPane;
04: 
05: /**
06:    A graphical simulation of an automatic teller machine.
07: */
08: public class ATMViewer
09: {  
10:    public static void main(String[] args)
11:    {  
12:       ATM theATM;
13: 
14:       try
15:       {  
16:          Bank theBank = new Bank();
17:          theBank.readCustomers("customers.txt");
18:          theATM = new ATM(theBank);
19:       }
20:       catch(IOException e)
21:       {  
22:          JOptionPane.showMessageDialog(null, 
23:                "Error opening accounts file.");
24:          return;
25:       }
26: 
27:       JFrame frame = new ATMFrame(theATM);
28:       frame.setTitle("First National Bank of Java");      
29:       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
30:       frame.setVisible(true);
31:    }
32: }
33: