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