/* *********************************************************** CHAPTER 7 EXTENDED EXAMPLE Initial phase of an automatic teller machine, consisting of a keypad, a collection of control buttons, a numeric display field, and a text area for instructions. ************************************************************* */ import java.applet.*; import java.awt.*; import java.awt.event.*; public class ATM1 extends Applet { private TextField display = new TextField(); private Keypad1 pad = new Keypad1(); private Button clear = new Button("Clear"), enter = new Button("Enter"), deposit = new Button("Deposit"), withdraw = new Button("Withdraw"); private TextArea help = new TextArea(6, 30); public void init() { Panel p1 = new Panel(); p1.setLayout(new GridLayout(4, 1, 0, 3)); p1.add(clear); p1.add(enter); p1.add(deposit); p1.add(withdraw); Panel p2 = new Panel(); p2.setLayout(new BorderLayout(3,0)); p2.add("Center", pad); p2.add("East", p1); Panel p3 = new Panel(); p3.setLayout(new BorderLayout()); p3.add("North", display); p3.add("Center", p2); this.setLayout(new BorderLayout(5,5)); this.add("Center",p3); this.add("East", help); help.setEditable(false); this.setBackground(Color.lightGray); this.setSize(400,150); } }