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

1    package addBk.addressBook; 
2     
3    //TextFieldPanel.javaTextFieldPanel.java 
4     
5     
6    import java.awt.*; 
7    import java.awt.event.ActionEvent; 
8    import java.awt.event.ActionListener; 
9    import java.awt.event.TextEvent; 
10   import java.awt.event.TextListener; 
11    
12   public class TextFieldPanel 
13           extends Panel 
14           implements ActionListener, TextListener { 
15       TextField t0 = 
16               new TextField("my number vc"); 
17       TextField t1 = 
18               new TextField("203-454-1234 fax"); 
19       TextField t2 = 
20               new TextField("203-543-2134 cell"); 
21    
22       public void actionPerformed( 
23               ActionEvent e) { 
24           System.out.println( 
25                   "command=" 
26                   + e.getActionCommand() 
27           ); 
28       } 
29    
30       public void textValueChanged( 
31               TextEvent e) { 
32           //System.out.println(e); 
33           AddressBookMediator display = 
34                   new AddressBookMediator(); 
35           display.setEditFlag(); 
36       } 
37    
38       TextFieldPanel() { 
39           setLayout( 
40                   new GridLayout(0, 1)); 
41           add(t0); 
42           add(t1); 
43           add(t2); 
44           t0.addTextListener(this); 
45           t1.addTextListener(this); 
46           t2.addTextListener(this); 
47    
48       } 
49   } 
50