Java GUI (1)-AWT component and layout management

Source: Internet
Author: User

I. Understand vocabulary

1. Common Words

2. java. AWT package

The Java. AWT package is a Java built-in package, which is part of the Java basic class library (jfc [Java foundation classes]) and contains the following content:

1. a rich set of interface components that are easy for users to enter;

2. Place components in several layout managers in the appropriate positions

3. Event Processing Model

4. Graphics and image tools

Use an explicit declaration statement: Import java. AWT .*;

3. My first GUI program:

 

Import java. AWT .*;

Public class awtdemo {

Public static void main (string ARGs []) {

New myframe ("My first GUI program", 100,100,100,100, color. Red );

}

}

Class myframe extends frame {

Myframe (string S, int X, int y, int W, int H, color ){

Super (s );

Setbackground (color );

Setlayout (null );

Setbounds (X, Y, W, H );

Setvisible (true );

}

}

Ii. architecture of the Space class in the Java. AWT package

 

Differences between window and panel: a panel cannot exist independently and must be placed in a window or another subclass.

2. Common AWT components

 

 

 

 

 

 

 

 

 

 

 

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.