1. /*
  2. * @(#)WindowListener.java 1.19 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.awt.event;
  8. import java.util.EventListener;
  9. /**
  10. * The listener interface for receiving window events.
  11. * The class that is interested in processing a window event
  12. * either implements this interface (and all the methods it
  13. * contains) or extends the abstract <code>WindowAdapter</code> class
  14. * (overriding only the methods of interest).
  15. * The listener object created from that class is then registered with a
  16. * Window using the window's <code>addWindowListener</code>
  17. * method. When the window's status changes by virtue of being opened,
  18. * closed, activated or deactivated, iconified or deiconified,
  19. * the relevant method in the listener object is invoked, and the
  20. * <code>WindowEvent</code> is passed to it.
  21. *
  22. * @author Carl Quinn
  23. * @version 1.19, 01/23/03
  24. *
  25. * @see WindowAdapter
  26. * @see WindowEvent
  27. * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/windowlistener.html">Tutorial: Writing a Window Listener</a>
  28. * @see <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>
  29. *
  30. * @since 1.1
  31. */
  32. public interface WindowListener extends EventListener {
  33. /**
  34. * Invoked the first time a window is made visible.
  35. */
  36. public void windowOpened(WindowEvent e);
  37. /**
  38. * Invoked when the user attempts to close the window
  39. * from the window's system menu. If the program does not
  40. * explicitly hide or dispose the window while processing
  41. * this event, the window close operation will be cancelled.
  42. */
  43. public void windowClosing(WindowEvent e);
  44. /**
  45. * Invoked when a window has been closed as the result
  46. * of calling dispose on the window.
  47. */
  48. public void windowClosed(WindowEvent e);
  49. /**
  50. * Invoked when a window is changed from a normal to a
  51. * minimized state. For many platforms, a minimized window
  52. * is displayed as the icon specified in the window's
  53. * iconImage property.
  54. * @see java.awt.Frame#setIconImage
  55. */
  56. public void windowIconified(WindowEvent e);
  57. /**
  58. * Invoked when a window is changed from a minimized
  59. * to a normal state.
  60. */
  61. public void windowDeiconified(WindowEvent e);
  62. /**
  63. * Invoked when the Window is set to be the active Window. Only a Frame or
  64. * a Dialog can be the active Window. The native windowing system may
  65. * denote the active Window or its children with special decorations, such
  66. * as a highlighted title bar. The active Window is always either the
  67. * focused Window, or the first Frame or Dialog that is an owner of the
  68. * focused Window.
  69. */
  70. public void windowActivated(WindowEvent e);
  71. /**
  72. * Invoked when a Window is no longer the active Window. Only a Frame or a
  73. * Dialog can be the active Window. The native windowing system may denote
  74. * the active Window or its children with special decorations, such as a
  75. * highlighted title bar. The active Window is always either the focused
  76. * Window, or the first Frame or Dialog that is an owner of the focused
  77. * Window.
  78. */
  79. public void windowDeactivated(WindowEvent e);
  80. }