-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAWTEventListenerProxy.java
More file actions
81 lines (74 loc) · 1.72 KB
/
AWTEventListenerProxy.java
File metadata and controls
81 lines (74 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.awt.event;
import java.util.EventListenerProxy;
import java.awt.AWTEvent;
/**
* A class which extends the {@code EventListenerProxy}
* specifically for adding an {@code AWTEventListener}
* for a specific event mask.
* Instances of this class can be added as {@code AWTEventListener}s
* to a {@code Toolkit} object.
* <p>
* The {@code getAWTEventListeners} method of {@code Toolkit}
* can return a mixture of {@code AWTEventListener}
* and {@code AWTEventListenerProxy} objects.
*
* @see java.awt.Toolkit
* @see java.util.EventListenerProxy
* @since 1.4
*/
public class AWTEventListenerProxy
extends EventListenerProxy<AWTEventListener>
implements AWTEventListener {
private final long eventMask;
/**
* Constructor which binds the {@code AWTEventListener}
* to a specific event mask.
*
* @param eventMask the bitmap of event types to receive
* @param listener the listener object
*/
public AWTEventListenerProxy (long eventMask, AWTEventListener listener) {
super(listener);
this.eventMask = eventMask;
}
/**
* Forwards the AWT event to the listener delegate.
*
* @param event the AWT event
*/
public void eventDispatched(AWTEvent event) {
getListener().eventDispatched(event);
}
/**
* Returns the event mask associated with the listener.
*
* @return the event mask associated with the listener
*/
public long getEventMask() {
return this.eventMask;
}
}