201671010110 2016 2017 2 "Java programming"

Source: Internet
Author: User
Tags event listener

In the THURSDAY study conducted the test, the following programming topics in the Friday experiment class, the teacher conducted a very careful explanation, the topic has a more in-depth understanding. Because it takes a lot of time to explain the programming topic, the 11th chapter is less explained in the experiment class. At the weekend to complete their own experimental work, while the content of the PPT carefully read. Graphical user interface GUI provides the user with interactive graphical user interface, and the program takes the user's input through GUI graphical UI, and outputs the result of running the program to the user. Java has a dedicated class library that generates a variety of standard graphical interface elements and various events for working with graphical interfaces.

Class library for generating graphical user interface elements: the java.awt package, which provides a basic Java program GUI design tool. Javax.swing package. Compared to AWT, swing has four advantages, lightweight components, a changing look, an MVC structure, and a more stable performance. Unlike AWT components, swing components cannot be added directly to the top-level container, which must be added to a Content Panel (pane) associated with the top-level container of swing.

Overview of the AWT event handling mechanism: Listener object: Is a class instance that implements a specific listener interface (listener interface). Event Source: An object that can register listener objects and send event objects. When an event occurs, the event source automatically passes the event object to all registered listeners. The listener object takes advantage of the information in the event object to determine how to respond to the event. In GUI design, when a programmer needs to respond to and process an event of a component, it must complete two steps: Registering an event listener for the component that implements the specified interface, defining an event listener class that implements an event listener interface, and materializing an event-handling abstract method declared in the interface.

201671010110 2016 2017 2 "Java programming"

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.