每个用户界面都考虑以下三个主要方面:

  • UI elements : 这些是用户最终看到并与之交互的核心视觉元素。GWT提供了大量从基本到复杂的广泛使用和常见元素,我们将在本教程中介绍。

  • Layouts: 它们定义应如何在屏幕上组织UI元素,并为GUI(图形用户界面)提供最终外观。这部分将在“布局”一章中介绍。

  • Behavior: 这些是在用户与UI元素进行交互时发生的事件。这部分将在事件处理一章中介绍。

AWT - 控件 - 图1

每个AWT控件都从Component类继承属性。

Sr. No.控制与说明
1

Component

A Component is an abstract super class for GUI controls and it represents an object with graphical representation.

AWT UI元素:

以下是使用AWT设计GUI时常用的控件列表。

Sr. No.控制与说明
1

Label

A Label object is a component for placing text in a container.

2

Button

This class creates a labeled button.

3

Check Box

A check box is a graphical component that can be in either an on (true) or off (false) state.

4

Check Box Group

The CheckboxGroup class is used to group the set of checkbox.

5

List

The List component presents the user with a scrolling list of text items.

6

Text Field

A TextField object is a text component that allows for the editing of a single line of text.

7

Text Area

A TextArea object is a text component that allows for the editing of a multiple lines of text.

8

Choice

A Choice control is used to show pop up menu of choices. Selected choice is shown on the top of the menu.

9

Canvas

A Canvas control represents a rectangular area where application can draw something or can receive inputs created by user.

10

Image

An Image control is superclass for all image classes representing graphical images.

11

Scroll Bar

A Scrollbar control represents a scroll bar component in order to enable user to select from range of values.

12

Dialog

A Dialog control represents a top-level window with a title and a border used to take some form of input from the user.

13

File Dialog

A FileDialog control represents a dialog window from which the user can select a file.