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