/Users/lyon/j4p/src/ip/gui/frames/JShortCutFrame.java

1    package ip.gui.frames; 
2     
3    import gui.PetriBean; 
4    import gui.JClosableFrame; 
5     
6    import javax.swing.*; 
7    import java.awt.*; 
8    import java.awt.event.ActionEvent; 
9    import java.awt.event.KeyEvent; 
10    
11   /** 
12    * 
13    */ 
14    
15   public class JShortCutFrame 
16           extends JClosableFrame 
17           implements ShortCutInterface { 
18    
19    
20       private PetriBean petriBean = new PetriBean(this); 
21    
22    
23       public JShortCutFrame(String title) { 
24           super(title); 
25           addKeyListener(this); 
26       } 
27    
28       public JShortCutFrame() { 
29           addKeyListener(this); 
30       } 
31    
32       public String getPs() { 
33           return petriBean.getPs(); 
34       } 
35    
36    
37       public boolean match(AWTEvent e, JMenuItem mi) { 
38           return petriBean.matchEvent(e, mi); 
39       } 
40    
41       public boolean match(AWTEvent e, MenuItem mi) { 
42           return petriBean.matchEvent(e, mi); 
43       } 
44    
45    
46       public void keyPressed(KeyEvent e) { 
47           petriBean.processEvent(e); 
48       } 
49    
50    
51       public void keyReleased(KeyEvent e) { 
52       } 
53    
54    
55       public void actionPerformed(ActionEvent e) { 
56       } 
57    
58    
59       public void keyTyped(KeyEvent e) { 
60       } 
61    
62       public Menu getMenu(String s) { 
63           return new Menu(s); 
64       } 
65    
66       public JMenuItem addMenuItem(JMenu aMenu, String itemName) { 
67           JMenuItem mi = new JMenuItem(itemName); 
68           aMenu.add(mi); 
69           mi.addActionListener(this); 
70           return (mi); 
71       } 
72    
73       public MenuItem addMenuItem(Menu aMenu, String itemName) { 
74           MenuItem mi = new MenuItem(itemName); 
75           aMenu.add(mi); 
76           mi.addActionListener(this); 
77           return (mi); 
78       } 
79   } 
80