/Users/lyon/j4p/src/addBk/addressBook/DialPanel.java

1    package addBk.addressBook; 
2     
3    //DialPanel.javaDialPanel.java 
4     
5    import java.awt.*; 
6    import java.awt.event.ActionEvent; 
7    import java.awt.event.ActionListener; 
8     
9    public class DialPanel extends Panel 
10           implements ActionListener { 
11    
12       Button b0 = new DialButton_1(); 
13       Button b1 = new DialButton_2(); 
14       Button b2 = new DialButton_3(); 
15    
16       public void 
17               actionPerformed(ActionEvent e) { 
18           ((Runnable) 
19                   e.getSource()).run(); 
20       } 
21    
22       DialPanel() { 
23           setLayout( 
24                   new GridLayout(0, 1)); 
25           add(b0); 
26           add(b1); 
27           add(b2); 
28    
29           b0.addActionListener(this); 
30           b1.addActionListener(this); 
31           b2.addActionListener(this); 
32    
33       } 
34    
35       public class DialButton_1 extends Button 
36               implements Runnable { 
37           DialButton_1() { 
38               super("dial"); 
39           } 
40    
41           public void run() { 
42               System.out.println("Run dialer"); 
43               new DosDialer(1); 
44           } 
45       } 
46    
47       public class DialButton_2 extends Button 
48               implements Runnable { 
49           DialButton_2() { 
50               super("dial"); 
51           } 
52    
53           public void run() { 
54               System.out.println("Run dialer"); 
55               new DosDialer(2); 
56           } 
57       } 
58    
59       public class DialButton_3 extends Button 
60               implements Runnable { 
61           DialButton_3() { 
62               super("dial"); 
63           } 
64    
65           public void run() { 
66               System.out.println("Run dialer"); 
67               new DosDialer(3); 
68           } 
69       } 
70    
71   }