The Java toolkit class provides three APIs related to awtevent:
1. Public void addawteventlistener (awteventlistener listener, long eventmask)
2. Public void removeawteventlistener (awteventlistener listener)
3. Public awteventlistener [] getawteventlisteners ()
1. addawteventlistener
Add an awteventlistener to receive all awtevent events. All AWT/swing events are subclasses of awtevent. Therefore, receiving all awtevent means receiving all AWT/swing events. The first listener parameter of the API indicates the global listener to be added to the JVM. This listener has a callback function eventdispatched (awtevent event ). All event responses should be completed in the callback function. The second parameter of this API is used to filter specific AWT/swing event types, such as awtevent. mouse_event_mask | wtevent. window_event_mask, indicating that only the mouseevent and javaswevent are received.
2. removeawteventlistener
Deletes the specified awteventlistener.
3. getawteventlisteners
Obtain all registered awteventlistener.
It is worth noting that this usage is used for special purposes and is not recommended for common applications.