1 | package genius.gui;
|
---|
2 |
|
---|
3 | import java.awt.Component;
|
---|
4 | import java.awt.Dimension;
|
---|
5 | import java.awt.Frame;
|
---|
6 |
|
---|
7 | import javax.swing.JFrame;
|
---|
8 | import javax.swing.JMenu;
|
---|
9 | import javax.swing.JMenuBar;
|
---|
10 | import javax.swing.JScrollPane;
|
---|
11 | import javax.swing.JSplitPane;
|
---|
12 | import javax.swing.JTabbedPane;
|
---|
13 |
|
---|
14 | import genius.gui.actions.AboutAction;
|
---|
15 | import genius.gui.actions.OpenManual;
|
---|
16 | import genius.gui.boaframework.BOARepositoryUI;
|
---|
17 | import genius.gui.domainrepository.DomainRepositoryUI;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * #2 future main application and main GUI panel.
|
---|
21 | */
|
---|
22 | @SuppressWarnings("serial")
|
---|
23 | public class MainPanel extends JFrame implements MainPanelInterface {
|
---|
24 |
|
---|
25 | private JTabbedPane repoArea = new JTabbedPane();
|
---|
26 | private JTabbedPane editArea = new JTabbedPane();
|
---|
27 |
|
---|
28 | public MainPanel() {
|
---|
29 | setMinimumSize(new Dimension(200, 100));
|
---|
30 | setTitle(
|
---|
31 | "GENIUS " + getClass().getPackage().getImplementationVersion());
|
---|
32 | JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
|
---|
33 | repoArea, editArea);
|
---|
34 | add(splitpane);
|
---|
35 | repoArea.addTab("Domains",
|
---|
36 | new JScrollPane(new DomainRepositoryUI(this)));
|
---|
37 | repoArea.addTab("BOA Components",
|
---|
38 | new JScrollPane(new BOARepositoryUI()));
|
---|
39 |
|
---|
40 | setJMenuBar(new MenuBar());
|
---|
41 |
|
---|
42 | }
|
---|
43 |
|
---|
44 | public static void main(String[] args) {
|
---|
45 | MainPanel mainpanel = new MainPanel();
|
---|
46 |
|
---|
47 | mainpanel.pack();
|
---|
48 | mainpanel.show();
|
---|
49 |
|
---|
50 | }
|
---|
51 |
|
---|
52 | @Override
|
---|
53 | public void addTab(String title, Component comp) {
|
---|
54 | editArea.addTab(title, comp);
|
---|
55 | }
|
---|
56 |
|
---|
57 | @Override
|
---|
58 | public Frame getMainFrame() {
|
---|
59 | return this;
|
---|
60 | }
|
---|
61 | }
|
---|
62 |
|
---|
63 | class MenuBar extends JMenuBar {
|
---|
64 | private JMenu startMenu = new JMenu();
|
---|
65 | private JMenu helpMenu = new JMenu();
|
---|
66 |
|
---|
67 | public MenuBar() {
|
---|
68 | startMenu.setText("Start");
|
---|
69 | startMenu.setName("startMenu");
|
---|
70 | add(startMenu);
|
---|
71 |
|
---|
72 | helpMenu.setText("Help");
|
---|
73 | helpMenu.setName("startMenu");
|
---|
74 | helpMenu.add(new OpenManual());
|
---|
75 | helpMenu.add(new AboutAction());
|
---|
76 | add(helpMenu);
|
---|
77 | }
|
---|
78 | } |
---|