aboutsummaryrefslogtreecommitdiff
path: root/src/Menu.java
blob: b741aaf6a65a35ffee7f9a047cb8832277fcb55b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*    */ import java.awt.event.ActionEvent;
/*    */ import java.awt.event.ActionListener;
/*    */ import javax.swing.AbstractButton;
/*    */ import javax.swing.JComponent;
/*    */ import javax.swing.JMenu;
/*    */ 
/*    */ public class Menu extends JMenu
/*    */   implements ActionListener
/*    */ {
/*    */   private JComponent[] comps;
/*    */ 
/*    */   public Menu(String name, JComponent[] args)
/*    */   {
/* 14 */     super(name);
/* 15 */     this.comps = args;
/* 16 */     for (int i = 0; i < args.length; i++) {
/* 17 */       add(args[i]);
/* 18 */       if ((args[i] instanceof AbstractButton))
/* 19 */         ((AbstractButton)args[i]).addActionListener(this); 
/*    */     }
/*    */   }
/*    */ 
/* 23 */   public JComponent get(int x) { return this.comps[x]; } 
/*    */   public void actionPerformed(ActionEvent e) {
/* 25 */     for (int i = 0; i < getActionListeners().length; i++) getActionListeners()[i].actionPerformed(e);
/*    */   }
/*    */ }

/* Location:           Modulus.jar
 * Qualified Name:     Menu
 * JD-Core Version:    0.6.2
 */