2. Objective
On completion of this period, you would be
able to know
• Overview of AWT Classes
http://improvejava.blogspot.in/
2
3. Recap
In the previous class, you have leant
• The simple applet programs
http://improvejava.blogspot.in/
3
4. AWT Classes
• AWT stand for ‘Abstract Windowing Toolkit’
• The AWT classes are available in the java.awt package
• It is one of Java’s largest packages
• The main purpose of the AWT is to support applet
windows
• It can also be used to create stand-alone windows that
run in a GUI environment, such as Windows
http://improvejava.blogspot.in/
4
5. AWT Classes contd..
• The basic structure of the AWT has been the same
since Java 1.0
• Some of the original methods were deprecated and
replaced by new ones when Java 1.1 was released
• For backward-compatibility, Java 2 still supports all the
original 1.0 methods
• The following tables lists the important AWT classes
http://improvejava.blogspot.in/ 5
5
6. AWT Classes contd..
AWTEvent Encapsulates AWT events
Button Creates a push button control
Canvas A blank, semantics-free window
Checkbox Creates a check box control
CheckboxGroup Creates a group of check box controls
CheckboxMenuItem Creates an on/off menu item
Choice Creates a pop-up list
Manages colors in a portable, platform-independent
Color
fashion
Component An abstract superclass for various AWT components
A subclass of Component that can hold other
Container
components
http://improvejava.blogspot.in/ 6
7. AWT Classes contd..
Cursor Encapsulates a bitmapped cursor
Dialog Creates a dialog window
Dimension Specifies the dimensions of an object, i.e. width and height
Event Encapsulates events
EventQueue Queues events
FileDialog Creates a window from which a file can be selected
Font Encapsulates a type font
FontMetrics Encapsulates various information related to a font
Creates a standard window that has a title bar, resize
Frame
corners, and a menu bar
Graphics Encapsulates the graphics context. This context is
http://improvejava.blogspot.in/ 7
8. AWT Classes contd..
Image Encapsulates graphical images
Insets Encapsulates the borders of a container
Label Creates a label that displays a string
Creates a list from which the user can choose. Similar to
List
the standard Windows list box
MediaTracker Manages media objects
Menu Creates a pull-down menu
MenuBar Creates a menu bar
MenuComponent An abstract class implemented by various menu classes
MenuItem Creates a menu item
MenuShortcut Encapsulates a keyboard shortcut for a menu item
http://improvejava.blogspot.in/ 8
9. AWT Classes contd..
Panel The simplest concrete subclass of Container
Point Encapsulates a Cartesian coordinate pair, stored in x and y
Polygon Encapsulates a polygon
PopupMenu Encapsulates a pop-up menu
PrintJob An abstract class that represents a print job
Rectangle Encapsulates a rectangle
Scrollbar Creates a scroll bar control
A container that provides horizontal and/or vertical scroll bars
ScrollPane
for another component
Contains the colors of GUI widgets such as windows, scroll
SystemColor
bars, text, and others
TextField Creates a single-line edit control
http://improvejava.blogspot.in/ 9
10. AWT Classes contd..
TextArea Creates a multiline edit control
TextComponen
A superclass for TextArea and TextField
t
Toolkit Abstract class implemented by the AWT
Window Creates a window with no frame, no menu bar, and no title
http://improvejava.blogspot.in/ 10
11. Discussion
• Compare the names of Java’s AWT components with VB’s
GUI controls
In Java In VB
Label Label
TextField Textbox
TextArea Textbox
Choice ComboBox
Button CommandButton
http://improvejava.blogspot.in/ 11
12. Summary
• In this class we have discussed
– The AWT classes
– Listed AWT classes with proper description
http://improvejava.blogspot.in/ 12
13. Quiz
1.Which of the following classes is not in awt
package
a) Button
b) Thread
c) Panel
d) Menu
http://improvejava.blogspot.in/ 13
14. Quiz contd..
2. Which of the following classes is not useful for
user data entry
a) TextField
b) TextArea
c) Label
d) Choice
http://improvejava.blogspot.in/ 14
15. Frequently Asked Questions
1. List the AWT classes that are useful for user
data entry
2. List the AWT classes for menu processing
http://improvejava.blogspot.in/ 15