1 /*
2 * MythSim
3 *
4 * Copyright (C) 2002-2004 Jason Vroustouris <jasonv@jasonv.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 package org.mythsim.swing;
22 import javax.swing.*;
23 import javax.swing.event.*;
24 import java.awt.event.*;
25
26 /***
27 * The menu bar at the top of the frame.
28 * @author Jason Vroustouris
29 */
30 public class MythMenuBar extends JMenuBar {
31 MythSimSwing ms = null;
32 public MythMenuBar(MythSimSwing mythSim)
33 {
34 ms = mythSim;
35
36 // File Menu
37 JMenu fileMenu = new JMenu("File");
38 fileMenu.add(ms.createJMenuItem(MythSimSwing.OPEN_ACTION));
39 JMenuItem reloadJMenuItem = ms.createJMenuItem(MythSimSwing.RELOAD_ACTION);
40 reloadJMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F7,0));
41 fileMenu.add(reloadJMenuItem);
42 fileMenu.add(new AbstractAction("Exit") {
43 public void actionPerformed(ActionEvent a) {
44 System.exit(0);
45 }
46 });
47 add(fileMenu);
48
49 // Simulate Menu
50 JMenu simulateMenu = new JMenu("Run");
51 JMenuItem runMenuItem = ms.createJMenuItem(MythSimSwing.RUN_ACTION);
52 runMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5,0));
53 simulateMenu.add(runMenuItem);
54 simulateMenu.add(ms.createJMenuItem(MythSimSwing.RESET_ACTION));
55 simulateMenu.addSeparator();
56 simulateMenu.add(ms.createJMenuItem(MythSimSwing.MINUS100_ACTION));
57 simulateMenu.add(ms.createJMenuItem(MythSimSwing.MINUS10_ACTION));
58 simulateMenu.add(ms.createJMenuItem(MythSimSwing.MINUS1_ACTION));
59 simulateMenu.add(ms.createJMenuItem(MythSimSwing.PLUS1_ACTION));
60 simulateMenu.add(ms.createJMenuItem(MythSimSwing.PLUS10_ACTION));
61 simulateMenu.add(ms.createJMenuItem(MythSimSwing.PLUS100_ACTION));
62 simulateMenu.addSeparator();
63 simulateMenu.add(ms.createJMenuItem(MythSimSwing.LAST_ACTION));
64 simulateMenu.add(ms.createJMenuItem(MythSimSwing.NEXT_ACTION));
65 add(simulateMenu);
66
67 // Plugin Menu
68 JMenu windowMenu = ms.getPluginJMenu();
69 add(windowMenu);
70
71 // Help Menu
72 JMenu helpMenu = new JMenu("Help");
73 helpMenu.add(new AbstractAction("About") {
74 public void actionPerformed(ActionEvent a) {
75 MainAboutJDialog majd = new MainAboutJDialog(new JFrame());
76 }
77 });
78 add(helpMenu);
79 }
80 }
This page was automatically generated by Maven