Unit 5
Unit 5
GUI Programming
with Java:
AWT and Swing
The AWT Class Hierarchy
Abstract Window Toolkit(AWT)
• The AWT contains numerous classes and
methods that allow you to create and
manage windows.
• Although a common use of the AWT is in
applets, it is also used to create stand-
alone
windows that run in a GUI environment,
such as Windows.
• Today, most Java programs employ user
interfaces based on Swing.
AWT components are heavy weight. Swing components are light weight.
AWT components are platform dependent so Swing components are platform independent so
there look and feel changes according to OS. there look and feel remains constant.
AWT components are not very good in look and Swing components are better in look and feel as
feel as compared to Swing components. See the compared to AWT. See the button in below
button in below image, its look is not good image, its look is better than button created
as button created using Swing. using AWT.
No. Java AWT Java Swing
1) AWT components are platform-dependent. Java swing components
are platform-independent.
Privileged applets
• Privileged applets do not have the security
restrictions that are imposed on sandbox
applets and can run outside the security
sandbox.