AWT stands for Abstract Windowing Toolkit and is a package in Java that provides classes for graphical user interface (GUI) components like buttons, checkboxes, labels, and text fields. Some key AWT components include buttons, which are represented by single labels that can be clicked; labels, which display text and help demonstrate the functionality of other GUI elements; text fields, which allow scrolling text display in a single row; and checkboxes, which are labels that can be checked or unchecked and have a true/false state.
What is AWT in Java - An Abstract Windowing Toolkit
1. What is AWT in java
In this section, you will learn about the java.awt.*; package available with JDK. AWT stands
for Abstract Windowing Toolkit. It contains all classes to write the program that interface
between the user and different windowing toolkits. You can use the AWT package to
develop user interface objects like buttons, checkboxes, radio buttons and menus etc.
AWT Components
The class component is extended by all the AWT components. More of the codes can be
put to this class to design lot of AWT components. Most of the AWT components shown
below directly extend Component like Button, Canvas, Label etc.
Buttons
As shown in the example below, a button is represented by a single label. That is the label
shown in the example can be pushed with a click of a mouse.
2. Label
A displayed label object is known as the Label. Most of the times label is used to
demonstrate the significance of the other parts of the GUI. It helps to display the
functioning of the next text field. A label is also restricted to a single line of text as a button.
The example below shows the significance of Label.
In this example, we have added two labels in the applet as shown.
3. TextField
A scrollable text display object with one row of characters is known as the TextField. In the
example given below,
4. Checkbox
A checkbox is again a label which is displayed as a pushbutton as shown in the example
below. This pushbutton can either be checked or unchecked. Therefore, the state of the
checkbox is either true or false. However, the initial state is false which is the default one.
The example below shows the checkbox whose state gets toggled.