KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > importscrubber > ImportScrubberMenu


1 package net.sourceforge.importscrubber;
2
3 import java.awt.event.ActionEvent JavaDoc;
4 import java.awt.event.ActionListener JavaDoc;
5 import java.util.ResourceBundle JavaDoc;
6 import javax.swing.*;
7
8 /**
9  * Encapsulates the ImportScrubber GUI menu.
10  */

11
12 public class ImportScrubberMenu extends JMenuBar
13 {
14     private class MyAboutWindow implements ActionListener JavaDoc
15     {
16         public void actionPerformed(ActionEvent JavaDoc e)
17         {
18             JOptionPane.showMessageDialog(ImportScrubberMenu.this, _helpMsg);
19         }
20     }
21
22     private class ExitActionListener implements ActionListener JavaDoc
23     {
24         public void actionPerformed(ActionEvent JavaDoc e)
25         {
26             _frame.destroy();
27         }
28     }
29
30     private ImportScrubberGUI _frame;
31     private String JavaDoc _helpMsg;
32
33     public ImportScrubberMenu(ImportScrubberGUI frame)
34     {
35         _frame = frame;
36
37         ResourceBundle JavaDoc res = ResourceBundle.getBundle("net.sourceforge.importscrubber.Resources");
38
39         _helpMsg = res.getString(Resources.HELP_MESSAGE);
40
41         JMenu lFileMenu = new JMenu(res.getString(Resources.FILE_LABEL));
42         lFileMenu.setMnemonic('f');
43         JMenuItem lExitItem = new JMenuItem(res.getString(Resources.EXIT_LABEL));
44         lExitItem.setMnemonic('x');
45         lExitItem.addActionListener(new ExitActionListener());
46         lFileMenu.add(lExitItem);
47
48         JMenu lHelpMenu = new JMenu(res.getString(Resources.HELP_LABEL));
49         lHelpMenu.setMnemonic('h');
50         JMenuItem lAboutItem = new JMenuItem(res.getString(Resources.ABOUT_LABEL));
51         lAboutItem.setMnemonic('a');
52         lAboutItem.addActionListener(new MyAboutWindow());
53         lHelpMenu.add(lAboutItem);
54
55         add
56             (lFileMenu);
57         add
58             (lHelpMenu);
59     }
60
61 }
62
Popular Tags