[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;
|
---|
[14] | 17 | import genius.gui.boaframework.BOARepositoryUI;
|
---|
[11] | 18 | import genius.gui.domainrepository.DomainRepositoryUI;
|
---|
[1] | 19 |
|
---|
[12] | 20 | /**
|
---|
| 21 | * #2 future main application and main GUI panel.
|
---|
[15] | 22 | *
|
---|
[12] | 23 | */
|
---|
[1] | 24 | @SuppressWarnings("serial")
|
---|
[11] | 25 | public class MainPanel extends JFrame implements MainPanelInterface {
|
---|
[1] | 26 |
|
---|
[11] | 27 | private JTabbedPane repoArea = new JTabbedPane();
|
---|
| 28 | private JTabbedPane editArea = new JTabbedPane();
|
---|
[1] | 29 |
|
---|
| 30 | public MainPanel() {
|
---|
[15] | 31 | setLayout(new BorderLayout());
|
---|
[1] | 32 | setMinimumSize(new Dimension(200, 100));
|
---|
[11] | 33 | setTitle(
|
---|
| 34 | "GENIUS " + getClass().getPackage().getImplementationVersion());
|
---|
| 35 | JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
|
---|
| 36 | repoArea, editArea);
|
---|
[15] | 37 | add(splitpane, BorderLayout.CENTER);
|
---|
[11] | 38 | repoArea.addTab("Domains",
|
---|
| 39 | new JScrollPane(new DomainRepositoryUI(this)));
|
---|
[14] | 40 | repoArea.addTab("BOA Components",
|
---|
| 41 | new JScrollPane(new BOARepositoryUI()));
|
---|
[1] | 42 |
|
---|
| 43 | setJMenuBar(new MenuBar());
|
---|
| 44 |
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | public static void main(String[] args) {
|
---|
| 48 | MainPanel mainpanel = new MainPanel();
|
---|
[11] | 49 |
|
---|
[1] | 50 | mainpanel.pack();
|
---|
[15] | 51 | mainpanel.setVisible(true);
|
---|
[11] | 52 |
|
---|
[1] | 53 | }
|
---|
[11] | 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 | }
|
---|
[1] | 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 | } |
---|