The relationship and difference between AWT and swing in Java

Source: Internet
Author: User
Overview

AWT is the Abstraction Component Window Toolkit, the earliest Java development package for writing graphical applications.

Swing is an AWT-based package developed to supplement some of AWT's functional deficiencies.

Description of package java.awt

Contains all classes for creating the user interface and drawing graphics images. In AWT terminology, user interface objects such as buttons or scroll bars are called components. The Component class is the root of all AWT components. For a detailed description of the public properties of all AWT components, see Component.

When a user interacts with a component, some components fire the event. The AWTEvent class and its subclasses are used to represent events that the AWT component can fire. For a description of the AWT event model, see AWTEvent.

A container is a component that can contain components and other containers. A container can also have a layout manager to control the visual layout of components in a container. The AWT package comes with several layout manager classes and an interface that can be used to build your own layout manager.

Since AWT relies on local methods to implement its functionality, we often refer to AWT controls as heavyweight controls.

Package javax.swing

Provides a set of "lightweight" (all Java-language) components that try to make these components work the same way on all platforms.

Summarize

Due to the different implementations, AWT is a C/s program that takes advantage of local methods, runs faster, consumes less resources, and swing is a Java program based on AWT, so it runs slowly. For embedded applications, AWT is often used, often in standard Java applications, with swing sacrificing speed for development efficiency and functionality.

My humble learning is shallow, if there is inappropriate or wrong place, hope to give positive.

2017-09-11

The relationship and difference between AWT and swing in Java

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.