KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > ui > ApplicationFrame


1 /* ========================================================================
2  * JCommon : a free general purpose class library for the Java(tm) platform
3  * ========================================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jcommon/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * ---------------------
28  * ApplicationFrame.java
29  * ---------------------
30  * (C) Copyright 2000-2004, by Object Refinery Limited.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: ApplicationFrame.java,v 1.4 2005/11/16 15:58:41 taqua Exp $
36  *
37  * Changes (from 30-May-2002)
38  * --------------------------
39  * 30-May-2002 : Added title (DG);
40  * 13-Oct-2002 : Fixed errors reported by Checkstyle (DG);
41  *
42  */

43
44 package org.jfree.ui;
45
46 import java.awt.event.WindowEvent JavaDoc;
47 import java.awt.event.WindowListener JavaDoc;
48
49 import javax.swing.JFrame JavaDoc;
50
51 /**
52  * A base class for creating the main frame for simple applications. The frame listens for
53  * window closing events, and responds by shutting down the JVM. This is OK for small demo
54  * applications...for more serious applications, you'll want to use something more robust.
55  *
56  * @author David Gilbert
57  */

58 public class ApplicationFrame extends JFrame JavaDoc implements WindowListener JavaDoc {
59
60     /**
61      * Constructs a new application frame.
62      *
63      * @param title the frame title.
64      */

65     public ApplicationFrame(final String JavaDoc title) {
66         super(title);
67         addWindowListener(this);
68     }
69
70     /**
71      * Listens for the main window closing, and shuts down the application.
72      *
73      * @param event information about the window event.
74      */

75     public void windowClosing(final WindowEvent JavaDoc event) {
76         if (event.getWindow() == this) {
77             dispose();
78             System.exit(0);
79         }
80     }
81
82     /**
83      * Required for WindowListener interface, but not used by this class.
84      *
85      * @param event information about the window event.
86      */

87     public void windowClosed(final WindowEvent JavaDoc event) {
88         // ignore
89
}
90
91     /**
92      * Required for WindowListener interface, but not used by this class.
93      *
94      * @param event information about the window event.
95      */

96     public void windowActivated(final WindowEvent JavaDoc event) {
97         // ignore
98
}
99
100     /**
101      * Required for WindowListener interface, but not used by this class.
102      *
103      * @param event information about the window event.
104      */

105     public void windowDeactivated(final WindowEvent JavaDoc event) {
106         // ignore
107
}
108
109     /**
110      * Required for WindowListener interface, but not used by this class.
111      *
112      * @param event information about the window event.
113      */

114     public void windowDeiconified(final WindowEvent JavaDoc event) {
115         // ignore
116
}
117
118     /**
119      * Required for WindowListener interface, but not used by this class.
120      *
121      * @param event information about the window event.
122      */

123     public void windowIconified(final WindowEvent JavaDoc event) {
124         // ignore
125
}
126
127     /**
128      * Required for WindowListener interface, but not used by this class.
129      *
130      * @param event information about the window event.
131      */

132     public void windowOpened(final WindowEvent JavaDoc event) {
133         // ignore
134
}
135
136 }
137
Popular Tags