Listen to all Java program events

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.