ApplicationFrame.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.5 2007/11/02 17:50:36 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. package org.jfree.ui;
  44. import java.awt.event.WindowEvent;
  45. import java.awt.event.WindowListener;
  46. import javax.swing.JFrame;
  47. /**
  48. * A base class for creating the main frame for simple applications. The frame listens for
  49. * window closing events, and responds by shutting down the JVM. This is OK for small demo
  50. * applications...for more serious applications, you'll want to use something more robust.
  51. *
  52. * @author David Gilbert
  53. */
  54. public class ApplicationFrame extends JFrame implements WindowListener {
  55. /**
  56. * Constructs a new application frame.
  57. *
  58. * @param title the frame title.
  59. */
  60. public ApplicationFrame(final String title) {
  61. super(title);
  62. addWindowListener(this);
  63. }
  64. /**
  65. * Listens for the main window closing, and shuts down the application.
  66. *
  67. * @param event information about the window event.
  68. */
  69. public void windowClosing(final WindowEvent event) {
  70. if (event.getWindow() == this) {
  71. dispose();
  72. System.exit(0);
  73. }
  74. }
  75. /**
  76. * Required for WindowListener interface, but not used by this class.
  77. *
  78. * @param event information about the window event.
  79. */
  80. public void windowClosed(final WindowEvent event) {
  81. // ignore
  82. }
  83. /**
  84. * Required for WindowListener interface, but not used by this class.
  85. *
  86. * @param event information about the window event.
  87. */
  88. public void windowActivated(final WindowEvent event) {
  89. // ignore
  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 windowDeactivated(final WindowEvent event) {
  97. // ignore
  98. }
  99. /**
  100. * Required for WindowListener interface, but not used by this class.
  101. *
  102. * @param event information about the window event.
  103. */
  104. public void windowDeiconified(final WindowEvent event) {
  105. // ignore
  106. }
  107. /**
  108. * Required for WindowListener interface, but not used by this class.
  109. *
  110. * @param event information about the window event.
  111. */
  112. public void windowIconified(final WindowEvent event) {
  113. // ignore
  114. }
  115. /**
  116. * Required for WindowListener interface, but not used by this class.
  117. *
  118. * @param event information about the window event.
  119. */
  120. public void windowOpened(final WindowEvent event) {
  121. // ignore
  122. }
  123. }