Line | |
---|
1 | package smed.menu;
|
---|
2 |
|
---|
3 | import java.awt.event.KeyEvent;
|
---|
4 | import java.util.ArrayList;
|
---|
5 | import java.util.List;
|
---|
6 |
|
---|
7 | import javax.swing.DefaultListModel;
|
---|
8 | import javax.swing.JMenu;
|
---|
9 | import javax.swing.JMenuBar;
|
---|
10 | import javax.swing.JMenuItem;
|
---|
11 |
|
---|
12 | import smed.menu.file.TabManager;
|
---|
13 | import smed.plug.ifc.SmedPluggable;
|
---|
14 | import smed.tabs.SmedTabbedPane;
|
---|
15 |
|
---|
16 | public class SmedMenuBar extends JMenuBar {
|
---|
17 |
|
---|
18 | /**
|
---|
19 | *
|
---|
20 | */
|
---|
21 | private static final long serialVersionUID = 1L;
|
---|
22 |
|
---|
23 | JMenuBar menuBar;
|
---|
24 | JMenu menu, submenu;
|
---|
25 | JMenuItem menuItem;
|
---|
26 | private List<SmedPluggable> plugins = null;
|
---|
27 |
|
---|
28 | public SmedMenuBar() {
|
---|
29 | menuBar = new JMenuBar();
|
---|
30 |
|
---|
31 | menu = new JMenu("File");
|
---|
32 | menu.setMnemonic(KeyEvent.VK_F);
|
---|
33 | menu.getAccessibleContext().setAccessibleDescription(
|
---|
34 | "The only menu in this program that has menu items");
|
---|
35 |
|
---|
36 | menuItem = new JMenuItem("Tabmanager",
|
---|
37 | KeyEvent.VK_T);
|
---|
38 |
|
---|
39 | menuItem.addActionListener(new java.awt.event.ActionListener() {
|
---|
40 |
|
---|
41 | public void actionPerformed(java.awt.event.ActionEvent e) {
|
---|
42 | DefaultListModel myModel = new DefaultListModel();
|
---|
43 | plugins = SmedTabbedPane.getPlugins();
|
---|
44 |
|
---|
45 | for(SmedPluggable p : plugins) myModel.addElement (p.getName());
|
---|
46 |
|
---|
47 | new TabManager(myModel);
|
---|
48 | }
|
---|
49 | });
|
---|
50 |
|
---|
51 |
|
---|
52 | menu.add(menuItem);
|
---|
53 |
|
---|
54 | menuBar.add(menu);
|
---|
55 |
|
---|
56 | add(menuBar);
|
---|
57 | }
|
---|
58 |
|
---|
59 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.