Java Basic Learning summary-graphical user interface GUI (hold more)

Source: Internet
Author: User
Tags java se

  Although Java is not currently the backbone of front-end development, but as part of the basics of java, it is necessary to learn Java GUI programming, and can make some small and interesting graphics programs to improve learning Enthusiasm. This study summary is a beginner notes and experience, if there is no description or errors, please correct Me.

1. Javagui main development tools--the birth and function of swing class library

A qualified Java Developer, not only to master the technology, but also to have a certain knowledge of the Java historical background Reserves. So let's start with a brief introduction to the main class library for Javagui development: Swing.

In the Java 1.0 era there is a basic class library of design gui, abstract Window Toolkit, abbreviated as AWT. The AWT library works by delegating the task of handling user interface elements to the local GUI toolbox of the target platform (operating system), which is responsible for the creation and movement of user interface elements by the local GUI Toolkit. This kind of working method is advantageous and has the disadvantage , the first point is:

    • The processing speed may be a little faster.
    • Can adapt to different platforms, "write once, use everywhere."

Disadvantages:

    • The perception depends on the target platform.
    • Some platforms do not have a rich interface component (early) like Windows or Mac. So the design work of AWT is limited to the "lowest common denominator".
    • There are different bugs on different platforms.

In 1996,Netscape created another GUI library ifc, which works by drawing user interface components to a blank window, while the peer is only responsible for creating and drawing blank Windows . Sun and Netscape collaborated and perfected this approach by creating a user interface library called swing, which was the birth of Swing.

But swing does not completely replace awt, and there are still two functional libraries for AWT and swing in Java SE 8:

    • AWT Import java.awt (java as core Pack)
    • Swing Import javax.swing (javax package as feature expansion Pack)

The reason swing does not completely replace AWT is that swing is based on the AWT architecture, and swing simply provides a more powerful user interface Component. In a program written by swing, AWT is still required for event handling . Simply put,Swing is the user interface class, and AWT is the underlying mechanism .

Inheritance hierarchies for frameworks and component classes in AWT and swing

  2. Creating the JFrame Framework

3. Add a text component to the frame jcomponent

  

Java Basic Learning summary-graphical user interface GUI (hold more)

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.