aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/testrig/DemoMenu.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/uk/org/ury/testrig/DemoMenu.java')
-rw-r--r--src/uk/org/ury/testrig/DemoMenu.java112
1 files changed, 112 insertions, 0 deletions
diff --git a/src/uk/org/ury/testrig/DemoMenu.java b/src/uk/org/ury/testrig/DemoMenu.java
new file mode 100644
index 0000000..bc4636b
--- /dev/null
+++ b/src/uk/org/ury/testrig/DemoMenu.java
@@ -0,0 +1,112 @@
+package uk.org.ury.testrig;
+
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+
+import uk.org.ury.frontend.FrontendFrame;
+import uk.org.ury.frontend.FrontendModulePanel;
+
+
+/**
+ * Application frontend, for testing early-stage frontend code.
+ *
+ * @author Matt Windsor
+ *
+ */
+
+public class DemoMenu
+{
+ private FrontendFrame frame;
+
+ /**
+ * Main method.
+ *
+ * @param args The command-line arguments to the program. These
+ * will be ignored.
+ */
+
+ public static void
+ main (String[] args)
+ {
+ DemoMenu dm = new DemoMenu ();
+ dm.run ();
+ }
+
+
+ /**
+ *
+ */
+
+ public void
+ loadModule (String module)
+ {
+ frame.loadModule (module, "testrig.DemoControlPanel");
+ }
+
+ /**
+ * Run the demo menu, creating a user interface.
+ */
+
+ public void
+ run ()
+ {
+ FrontendModulePanel panel = new FrontendModulePanel (null, frame)
+ {
+ private static final long serialVersionUID = 1L;
+
+ {
+ setLayout (new GridLayout (2, 1));
+
+ JButton lb = new JButton ("Library Viewer Demo");
+ JButton sb = new JButton ("Show Viewer Demo");
+
+ lb.addActionListener (new ActionListener ()
+ {
+
+ @Override
+ public void
+ actionPerformed (ActionEvent arg0)
+ {
+ loadModule ("library.viewer.LibraryViewer");
+ }
+
+ });
+
+
+ sb.addActionListener (new ActionListener ()
+ {
+
+ @Override
+ public void
+ actionPerformed (ActionEvent arg0)
+ {
+ loadModule ("show.viewer.ShowViewer");
+ }
+
+ });
+
+
+ add (lb);
+ add (sb);
+ }
+
+
+ /**
+ * @return the name of the module.
+ */
+
+ @Override
+ public String
+ getName ()
+ {
+ return "Demo Menu";
+ }
+ };
+
+
+ frame = new FrontendFrame (panel);
+ }
+}