"Fundamentals of Java language Programming"--event-driven programming--several issues

Source: Internet
Author: User
1. Can a button trigger the windowevent? Can a button trigger MouseEvent? Can a button trigger ActionEvent?
JButton can produce mouseevent and ActionEvent. Cannot trigger WindowEvent


2. Can a single source have multiple listeners? Can a listener have multiple sources? Can a listener make its own listener?
YES. YES. YES




3. Can internal classes be used in other classes that are not nested in him?
Objects of an inner class is often created in the outer class. But the can also create an object of a inner class from another class. If the inner class is nonstatic, you must first create a instance of the outer class, then use the following syntax to CR Eate an object for the inner class:
Outerclass.innerclass innerobject = Outerobject.new innerclass ();


If the inner class is static, use the following syntax to create a object for it:
Outerclass.innerclass innerobject = new Outerclass.innerclass ();

"Fundamentals of Java language Programming"--event-driven programming--several issues

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.