Awt 简明教程

AWT Containers

容器是 AWT GUI 组件的组成部分。容器提供了一个放置组件的空间。AWT 中的容器本身是一个组件,它增加了向自身添加组件的能力。以下是有待考虑的注意要点。

Containers are integral part of AWT GUI components. A container provides a space where a component can be located. A Container in AWT is a component itself and it adds the capability to add component to itself. Following are noticable points to be considered.

  1. Sub classes of Container are called as Containter. For example Panel, Frame and Window.

  2. Container can add only Component to itself.

  3. A default layout is present in each container which can be overridden using setLayout method.

Sr. No.

Container & Description

1

Container It is a generic container object which can contain other AWT components.

AWT UI Elements:

以下是使用 AWT 设计 GUI 时常用的容器列表。

Following is the list of commonly used containers while designed GUI using AWT.

Sr. No.

Container & Description

1

Panel Panel is the simplest container. It provides space in which any other component can be placed, including other panels.

2

Frame A Frame is a top-level window with a title and a border

3

Window A Window object is a top-level window with no borders and no menubar.