KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > client > manager > Menubar


1 package hero.client.manager;
2
3 /*
4 *
5 * Menubar.java -
6 * Copyright (C) 2002 Ecoo Team
7 * valdes@loria.fr
8 *
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 */

24
25 import java.awt.event.ActionEvent JavaDoc;
26 import java.awt.event.ActionListener JavaDoc;
27 import java.awt.Color JavaDoc;
28
29 import javax.swing.ImageIcon JavaDoc;
30 import javax.swing.JMenu JavaDoc;
31 import javax.swing.JMenuBar JavaDoc;
32 import javax.swing.JMenuItem JavaDoc;
33
34 public class Menubar extends JMenuBar JavaDoc {
35
36 static java.util.ResourceBundle JavaDoc resource = java.util.ResourceBundle.getBundle("resources.Traduction")/*#BundleType=List*/;
37
38   public Menubar(final Manager m) {
39     ClassLoader JavaDoc cl = m.getClass().getClassLoader();
40
41     JMenu JavaDoc menu;
42     JMenuItem JavaDoc mi;
43
44     menu = new JMenu JavaDoc(resource.getString("menubar.manager"));
45     menu.setBackground(new Color JavaDoc(153, 153, 255));
46     add(menu);
47
48     // New
49
mi = new JMenuItem JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/new.png")));
50     mi.setText(resource.getString("menubar.newproj"));
51     mi.setBackground(new Color JavaDoc(153, 153, 255));
52     mi.addActionListener (new ActionListener JavaDoc () {
53         public void actionPerformed (ActionEvent JavaDoc e) {
54         m.NewProject();
55         }
56     });
57     menu.add(mi);
58     
59     // Clone
60
mi = new JMenuItem JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/Copy.gif")));
61     mi.setText(resource.getString("menubar.cloneproj"));
62     mi.setBackground(new Color JavaDoc(153, 153, 255));
63     mi.addActionListener (new ActionListener JavaDoc () {
64         public void actionPerformed (ActionEvent JavaDoc e) {
65         m.CloneProject();
66         }
67     });
68     menu.add(mi);
69     
70     // Instantiate
71
mi = new JMenuItem JavaDoc(new ImageIcon JavaDoc(cl.getResource("images/Copy.gif")));
72      mi.setText(resource.getString("menubar.instproj"));
73      mi.setBackground(new Color JavaDoc(153, 153, 255));
74      mi.addActionListener (new ActionListener JavaDoc () {
75          public void actionPerformed (ActionEvent JavaDoc e) {
76          m.InstantiateProject();
77          }
78      });
79      menu.add(mi);
80
81     menu.addSeparator();
82
83     mi = new JMenuItem JavaDoc(resource.getString("menubar.exit"));
84     mi.setIcon(new ImageIcon JavaDoc(cl.getResource("images/exit.png")));
85     mi.setBackground(new Color JavaDoc(153, 153, 255));
86     mi.addActionListener (new ActionListener JavaDoc () {
87       public void actionPerformed (ActionEvent JavaDoc e) {
88       try {
89           // JMSServices jms = JMSServices.getInstance();
90
// jms.closeConnection();
91
System.exit(0);
92       }catch(Exception JavaDoc ex){}
93       }
94     });
95     menu.add(mi);
96   }
97 }
98
Popular Tags