您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Content Index

Content Page # 6

AWT classes

There is an AWT class (or a Swing class) for each user interface element that Java understands. AWT classes provide functionality that is common to all 'real' elements of that class - for example an AWT 'button' has a label and can be 'pushed'.

AWT classes form a hierarchy (discussed later in this unit). The hierarchy can be expanded through subclassing by the programmer to extend functionality (to some degree).

For every user interface element that the user will see on the screen, there will be an object of a particular class in the Java program. These classes may be standard ones provided by the AWT, or created by the programmer. For example, to create a button to display, we could write:

Button myButton = new Button("Click me");

(The argument supplied to the button constructor here is the text that will appear on the button).

Back to top

basicline.gif (170 bytes)