Source code: evt/gui/JspmEvtMenuBar.java
1 /*-----------------------------------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (C) */
4 /* */
5 /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU */
6 /* General Public License as published by the Free Software Foundation; either version 2 of the */
7 /* License, or (at your option) any later version. */
8 /* */
9 /* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; */
10 /* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
11 /* PURPOSE. See the GNU General Public License for more details. */
12 /* */
13 /* You should have received a copy of the GNU General Public License along with this program; if */
14 /* not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA */
15 /* 02111-1307 USA */
16 /* */
17 /*-----------------------------------------------------------------------------------------------------*/
18 /* */
19 /* $Author: strand01 $ $Revision: 1.3 $ $Date: 2001/12/20 14:23:03 $ */
20 /* */
21 /*-----------------------------------------------------------------------------------------------------*/
22
23 package evt.gui;
24
25 // Java classes
26 import java.awt.*;
27 import java.awt.event.*;
28 import java.io.*;
29
30 // Swing classes
31 import javax.swing.*;
32
33 // JSPM classes
34 import com.jdk.*;
35
36 /**
37 * This class defines the menu bar for the JSPM Event Management.
38 *
39 * @author Steve Randall (strand012001@yahoo.com)
40 * @version 0.0.8
41 * @date 31/10/2001
42 */
43 public class JspmEvtMenuBar extends JMenuBar
44 {
45
46 /*
47 * The action listener
48 */
49 private ActionListener listener = null;
50
51 /**
52 * Constructor.
53 */
54 public JspmEvtMenuBar(ActionListener l)
55 {
56 super();
57
58 setFont(new Font("Ariel", Font.PLAIN, 11));
59 setPreferredSize(new Dimension(1024, 25));
60
61 listener = l;
62 }
63
64 public void init()
65 {
66 JMenu menu = new JMenu("File");
67 menu.setMnemonic('F');
68
69 JMenuItem menuItem = null;
70
71 menuItem = menu.add(new JMenuItem("Test"));
72 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
73 menuItem.setMnemonic('t');
74 menuItem.addActionListener(new ActionListener() {
75 public void actionPerformed(ActionEvent e) {
76 ((JspmEvtGui)listener).test();
77 }
78 });
79
80 menuItem = menu.add(new JMenuItem("Untest"));
81 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
82 menuItem.setMnemonic('t');
83 menuItem.addActionListener(new ActionListener() {
84 public void actionPerformed(ActionEvent e) {
85 ((JspmEvtGui)listener).untest();
86 }
87 });
88
89 menuItem = menu.add(new JMenuItem("Save"));
90 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
91 menuItem.setMnemonic('s');
92 menuItem.addActionListener(listener);
93
94 menuItem = menu.add(new JMenuItem("Save as..."));
95 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
96 menuItem.setMnemonic('a');
97 menuItem.addActionListener(listener);
98
99 menuItem = menu.add(new JMenuItem("Exit"));
100 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
101 menuItem.setMnemonic('x');
102 menuItem.addActionListener(new ActionListener() {
103 public void actionPerformed(ActionEvent e) {
104 System.exit(0);
105 }
106 });
107
108 add(menu);
109
110 menu = new JMenu("Edit");
111 menu.setMnemonic('E');
112
113 menuItem = menu.add(new JMenuItem("Refresh"));
114 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
115 menuItem.setMnemonic('r');
116 menuItem.addActionListener(new ActionListener() {
117 public void actionPerformed(ActionEvent e) {
118 ((JspmEvtGui)listener).refresh();
119 }
120 });
121
122 menu.addSeparator();
123
124 menuItem = menu.add(new JMenuItem("Select Server"));
125 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
126 menuItem.setMnemonic('s');
127 menuItem.addActionListener(new ActionListener() {
128 public void actionPerformed(ActionEvent e) {
129 ((JspmEvtGui)listener).getServerList();
130 }
131 });
132
133 add(menu);
134
135 menu = new JMenu("Options");
136 menu.setMnemonic('O');
137
138 menuItem = menu.add(new JMenuItem("Options"));
139 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
140 menuItem.setMnemonic('o');
141 menuItem.addActionListener(listener);
142
143 menuItem = menu.add(new JMenuItem("Filter"));
144 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
145 menuItem.setMnemonic('f');
146 menuItem.addActionListener(listener);
147
148 menu.addSeparator();
149
150 menuItem = menu.add(new JMenuItem("Save options"));
151 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
152 menuItem.setMnemonic('s');
153 menuItem.addActionListener(listener);
154
155 add(menu);
156
157 menu = new JMenu("Help");
158 menu.setMnemonic('H');
159
160 menuItem = menu.add(new JMenuItem("Help"));
161 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
162 menuItem.setMnemonic('H');
163 menuItem.addActionListener(new ActionListener() {
164 public void actionPerformed(ActionEvent e) {
165 try {
166
167 JspmBrowserLauncher.openURL("file://"+JspmEvtConstants.HELP_DIR+"/console.html");
168
169 } catch (IOException ex) {
170 }
171 }
172 });
173
174 menu.addSeparator();
175
176 menuItem = menu.add(new JMenuItem("About JSPM Event Console"));
177 menuItem.setFont(new Font("SansSerif", Font.PLAIN, 11));
178 menuItem.setMnemonic('a');
179 menuItem.addActionListener(new ActionListener() {
180 public void actionPerformed(ActionEvent e) {
181 ((JspmEvtGui)listener).about();
182 }
183 });
184
185 add(menu);
186 }
187 };
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216