Source for java.awt.event.AWTEventListenerProxy

   1: /*
   2:  * @(#)AWTEventListenerProxy.java    1.6 03/12/19
   3:  *
   4:  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
   5:  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
   6:  */
   7: 
   8: package java.awt.event;
   9: 
  10: import java.util.EventListenerProxy;
  11: import java.awt.AWTEvent;
  12: import java.awt.event.AWTEventListener;
  13: 
  14: /**
  15:  * A class which extends the <code>EventListenerProxy</code>, specifically 
  16:  * for adding an <code>AWTEventListener</code> for a specific event mask.
  17:  * Instances of this class can be added as <code>AWTEventListener</code>s to
  18:  * a Toolkit object. 
  19:  * <p>
  20:  * The <code>getAWTEventListeners</code> method of Toolkit can 
  21:  * return a mixture of <code>AWTEventListener</code> and
  22:  * <code>AWTEventListenerProxy</code> objects.
  23:  * 
  24:  * @see java.awt.Toolkit
  25:  * @see java.util.EventListenerProxy
  26:  * @since 1.4
  27:  */
  28: public class AWTEventListenerProxy extends EventListenerProxy
  29:	          implements AWTEventListener {
  30:
  31:    private long eventMask;
  32:
  33:    /**
  34:     * Constructor which binds the AWTEventListener to a specific
  35:     * event mask.
  36:     * 
  37:     * @param listener The listener object
  38:     * @param eventMask The bitmap of event types to receive
  39:     */ 
  40:    public AWTEventListenerProxy (long eventMask, 
  41:	              AWTEventListener listener) {
  42:        super(listener);
  43:        this.eventMask = eventMask;
  44:    }
  45:
  46:    /**
  47:     * Forwards the property change event to the listener delegate.
  48:     *
  49:     * @param evt the property change event
  50:     */
  51:	      public void eventDispatched(AWTEvent evt) {
  52:        ((AWTEventListener)getListener()).eventDispatched(evt);
  53:    }
  54:
  55:    /**
  56:     * Returns the event mask associated with the
  57:     * listener.
  58:     */
  59:	      public long getEventMask() {
  60:        return eventMask;
  61:    }
  62:}