01: /*
02: * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package org.mandarax.examples.family;
19:
20: import java.awt.event.WindowAdapter;
21: import java.awt.event.WindowEvent;
22:
23: /**
24: * Frame to display some demos. The demos are the test cases defined in the
25: * mandarax test package.
26: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
27: * @version 3.4 <7 March 05>
28: * @since 1.2
29: */
30: public class DemoLauncher extends javax.swing.JFrame {
31:
32: private boolean isMain = false;
33:
34: /**
35: * Constructor.
36: */
37: public DemoLauncher() {
38: super ("Demo Launcher for Mandarax");
39:
40: initialize();
41: }
42:
43: /**
44: * Dispose the window.
45: */
46: public void dispose() {
47: super .dispose();
48:
49: if (isMain) {
50: System.exit(0);
51: }
52: }
53:
54: /**
55: * Initialize the object.
56: */
57: private void initialize() {
58: getContentPane().setLayout(new java.awt.GridLayout(1, 1));
59: getContentPane().add(new DemoView());
60:
61: WindowAdapter wa = new WindowAdapter() {
62:
63: public void windowClosing(WindowEvent e) {
64: dispose();
65: }
66: };
67:
68: addWindowListener(wa);
69: }
70:
71: /**
72: * Application entry point.
73: * @param args java.lang.String[]
74: */
75: public static void main(String[] args) {
76: DemoLauncher l = new DemoLauncher();
77:
78: l.isMain = true;
79:
80: l.setSize(500, 300);
81: l.setVisible(true);
82: }
83: }
|