Javagui--awt

Source: Internet
Author: User

gui--graphical user Interface GUI. Introduction:
AWT is the first GUI class library package in the Java language. Java is a platform-independent programming language, but the GUI is often dependent on a specific platform, Java uses the appropriate technology to enable AWT to provide applications independent of the Machine platform interface, which ensures that the same program's GUI on different machines run with a similar look (not necessarily exactly the same).

Mind Mapping:


Content Description:
    • User interface Components
Component & Container container is a subclass of component, itself a component. component cannot be displayed independently and must be placed in the container. container adds component, including container objects, through the Add method.
Window&panel Window : Top-level windows that can be displayed directly. panel: Accommodates other component objects, but cannot be displayed independently and must be added to the window (Frame).
Create a frame:new frame (), or customize a class to inherit the frameto create a frame with a panel: Frame f =new Frame ("Java Frame with Panel"); Panel p = new Panel (null);
F.add (P);//The Panel must be added to the frame
    • Layout Manager
when you use the Layout manager, it manages the size and location of the component. If the user wants to set it up, setlayout (NULL) is requiredWhen a panel is added to a frame, the panel can still have its own layout manager
    • Event Processing Model
Application scenario: in short, it is a method that is not determined at the moment of invocation, and is executed only when it waits for a situation to occur. A situation occurs on behalf of an event.

principle: Event Source: The object that generated the event, such as clicking a button, which is the event sourceEvent object: Encapsulates the information of the event, such as: You can determine that the button you pressed is the OK button, not the Cancel button. Listener (event handler): The method that is called when an event occurs.
process: registers the listener in the listener list of the event source object, notifies the listener when a state of the event source changes, and the listener executes its own handler.
Common Listening interface: ActionListenerKeyListenerMouseListenerWindowListener
Monitoring Interface & Monitor Adapter the adapter implements a listening interface. custom listeners can implement interfaces, or they can inherit adapters. The former needs to implement all the interface methods, the latter only need to rewrite their own methods.
establishment of relationships between listeners and event source objects: Inner classhold the other referenceAnonymous Class
    • Graphics and imaging tools
GraphicsPaint and repaint


Javagui--awt

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.