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