01: package net.sourceforge.importscrubber;
02:
03: import java.awt.event.ActionEvent;
04: import java.awt.event.ActionListener;
05: import java.util.ResourceBundle;
06: import javax.swing.*;
07:
08: /**
09: * Encapsulates the ImportScrubber GUI menu.
10: */
11:
12: public class ImportScrubberMenu extends JMenuBar {
13: private class MyAboutWindow implements ActionListener {
14: public void actionPerformed(ActionEvent e) {
15: JOptionPane.showMessageDialog(ImportScrubberMenu.this ,
16: _helpMsg);
17: }
18: }
19:
20: private class ExitActionListener implements ActionListener {
21: public void actionPerformed(ActionEvent e) {
22: _frame.destroy();
23: }
24: }
25:
26: private ImportScrubberGUI _frame;
27: private String _helpMsg;
28:
29: public ImportScrubberMenu(ImportScrubberGUI frame) {
30: _frame = frame;
31:
32: ResourceBundle res = ResourceBundle
33: .getBundle("net.sourceforge.importscrubber.Resources");
34:
35: _helpMsg = res.getString(Resources.HELP_MESSAGE);
36:
37: JMenu lFileMenu = new JMenu(res.getString(Resources.FILE_LABEL));
38: lFileMenu.setMnemonic('f');
39: JMenuItem lExitItem = new JMenuItem(res
40: .getString(Resources.EXIT_LABEL));
41: lExitItem.setMnemonic('x');
42: lExitItem.addActionListener(new ExitActionListener());
43: lFileMenu.add(lExitItem);
44:
45: JMenu lHelpMenu = new JMenu(res.getString(Resources.HELP_LABEL));
46: lHelpMenu.setMnemonic('h');
47: JMenuItem lAboutItem = new JMenuItem(res
48: .getString(Resources.ABOUT_LABEL));
49: lAboutItem.setMnemonic('a');
50: lAboutItem.addActionListener(new MyAboutWindow());
51: lHelpMenu.add(lAboutItem);
52:
53: add(lFileMenu);
54: add(lHelpMenu);
55: }
56:
57: }
|