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