1 | package smed.menu;
|
---|
2 |
|
---|
3 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
4 |
|
---|
5 | import java.awt.Desktop;
|
---|
6 | import java.awt.event.KeyEvent;
|
---|
7 | import java.io.IOException;
|
---|
8 | import java.net.URI;
|
---|
9 | import java.net.URISyntaxException;
|
---|
10 | import java.util.ResourceBundle;
|
---|
11 |
|
---|
12 | import javax.swing.JMenu;
|
---|
13 | import javax.swing.JMenuBar;
|
---|
14 | import javax.swing.JMenuItem;
|
---|
15 |
|
---|
16 | import smed.menu.file.TabManager;
|
---|
17 |
|
---|
18 | public class SmedMenuBar extends JMenuBar {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | *
|
---|
22 | */
|
---|
23 | private static final long serialVersionUID = 1L;
|
---|
24 |
|
---|
25 | private String[] cmd = new String[4];
|
---|
26 |
|
---|
27 | private JMenuBar menuBar;
|
---|
28 | private JMenu menuFile, menuHelp, submenu;
|
---|
29 | private JMenuItem menuItemFile, menuItemOnLineHelp;
|
---|
30 |
|
---|
31 | public SmedMenuBar() {
|
---|
32 | cmd[0] = "cmd.exe";
|
---|
33 | cmd[1] = "/C";
|
---|
34 | cmd[2] = "start";
|
---|
35 | cmd[3] = "http://www.openseamap.org/";
|
---|
36 |
|
---|
37 | ResourceBundle keyEvents = ResourceBundle.getBundle("smed.keys.Events");
|
---|
38 |
|
---|
39 | menuBar = new JMenuBar();
|
---|
40 |
|
---|
41 | menuFile = new JMenu(tr("File"));
|
---|
42 | // menu.setMnemonic(KeyEvent.VK_F);
|
---|
43 | menuFile.setMnemonic((Integer) keyEvents.getObject("SmedMenuBar.001"));
|
---|
44 |
|
---|
45 | menuFile.getAccessibleContext().setAccessibleDescription(
|
---|
46 | "The only menu in this program that has menu items");
|
---|
47 |
|
---|
48 | menuItemFile = new JMenuItem("Tabmanager", KeyEvent.VK_T);
|
---|
49 | menuItemFile.addActionListener(new java.awt.event.ActionListener() {
|
---|
50 | public void actionPerformed(java.awt.event.ActionEvent e) { new TabManager(); }
|
---|
51 | });
|
---|
52 |
|
---|
53 | menuFile.add(menuItemFile);
|
---|
54 |
|
---|
55 | menuHelp = new JMenu(tr("Help"));
|
---|
56 | menuHelp.setMnemonic(KeyEvent.VK_H);
|
---|
57 |
|
---|
58 | menuItemOnLineHelp = new JMenuItem(tr("Online Help"), KeyEvent.VK_O);
|
---|
59 | menuItemOnLineHelp.addActionListener(new java.awt.event.ActionListener() {
|
---|
60 | public void actionPerformed(java.awt.event.ActionEvent e) {
|
---|
61 | try {
|
---|
62 | Desktop.getDesktop().browse( new URI("http://www.openseamap.org/") );
|
---|
63 | } catch (Exception ex) {
|
---|
64 | ex.printStackTrace();
|
---|
65 | }
|
---|
66 |
|
---|
67 | }
|
---|
68 |
|
---|
69 | });
|
---|
70 |
|
---|
71 | menuHelp.add(menuItemOnLineHelp);
|
---|
72 |
|
---|
73 | menuBar.add(menuFile);
|
---|
74 | menuBar.add(menuHelp);
|
---|
75 |
|
---|
76 | add(menuBar);
|
---|
77 | }
|
---|
78 |
|
---|
79 | }
|
---|