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

1    package addBk.addressBook; 
2     
3    //EditNavPanel 
4     
5    import java.awt.*; 
6    import java.awt.event.ActionEvent; 
7    import java.awt.event.ActionListener; 
8     
9     
10   public class EditNavPanel 
11           extends NavigationPanel 
12           implements ActionListener { 
13    
14       PreviousButton prevButton 
15               = new PreviousButton(); 
16    
17       Button nextButton 
18               = new NextButton(); 
19    
20       Button indexButton 
21               = new IndexButton(); 
22    
23       Button doneButton 
24               = new DoneButton(); 
25    
26       public void 
27               actionPerformed(ActionEvent e) { 
28           ((Runnable) 
29                   e.getSource()).run(); 
30       } 
31    
32    
33       EditNavPanel() { 
34           setLayout( 
35                   new GridLayout(0, 1)); 
36           add(prevButton); 
37           add(nextButton); 
38           add(indexButton); 
39           add(doneButton); 
40           prevButton.addActionListener(this); 
41           nextButton.addActionListener(this); 
42           indexButton.addActionListener(this); 
43           editButton.addActionListener(this); 
44       } 
45    
46       public class DoneButton extends Button 
47               implements Runnable { 
48           DoneButton() { 
49               super("Done"); 
50           } 
51    
52           public void run() { 
53               System.out.println("Run edit"); 
54               AddressBookMediator display = 
55                       new AddressBookMediator(); 
56               display.toggleEditPanel(); 
57           } 
58       } 
59    
60   } // end class EditNavPanel 
61