KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > apps > AWindowListener


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2002 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.apps;
15
16 import java.awt.*;
17 import java.awt.event.*;
18
19 /**
20  * Convenience Class to tunnel Events.
21  *
22  * Forwards Window Events like windowClosed to the WindowState listener.
23  * Usually, a WindowStateListener gets only state events (minimized,..)
24  * This allows implementing a single method (windowStateChanged)
25  * to receive potentially all window events.
26  * <p>
27  * Implemented:
28  * e.getID() == WindowEvent.WINDOW_CLOSED
29  *
30  * @author Jorg Janke
31  * @version $Id: AWindowListener.java,v 1.2 2002/08/12 01:55:13 danb Exp $
32  */

33 public class AWindowListener extends WindowAdapter
34 {
35     /**
36      * Constructor
37      *
38      * @param win Window
39      * @param l Listener
40      */

41     public AWindowListener (Window win, WindowStateListener l)
42     {
43         m_window = win;
44         m_listener = l;
45         win.addWindowListener(this);
46     } // AWindowListener
47

48     /** The Window */
49     private Window m_window;
50     /** The Listener */
51     private WindowStateListener m_listener;
52
53     /**
54      * Invoked when a window has been closed.
55      * Forwarded.
56      * @param e event to be forwarded
57      */

58     public void windowClosed(WindowEvent e)
59     {
60         m_listener.windowStateChanged(e);
61     } // windowClosed
62

63 } // AWindowListenr
64
Popular Tags