FAQ
Java Tutorial
Questions by Topic
Mock Exam 1
Mock Exam 2
Exam Simulator
Online Java Training
Other Certification sites
Certification Tips
Exam Objectives
About JavaPrepare
Books
Certification Books
SCEA Books
Online Books
Tutorial Topics
Language Fundamentals
Operator and Assignments
Declaration and Access Control
Classes in Java
Threads
Collections
Files
Advertisements

 
javaprepare.com
your tool for Java Certification
home | tutorial | questions | test 1

Abstract Windowing Toolkit

This topic is part of SCJP 1.2 exam but not SCJP 1.4 exam.

AWT class hierarchy
The JavaTM Foundation class (JFC) provides two frameworks for building GUI based applications - Abstract Windowing Toolkit (AWT) and swings. Sun's JavaTM Programmer Certification exam only covers AWT.

AWT's class hierarchy is explained below.


FIGURE AWTs class hierarchy

Key Concepts
Some things to note here are
  • Component is an abstract class. All other classes shown above are non-abstract (concrete).
  • Component class is superclass of all the non-menu related user interface classes. It provides support for event handling, drawing of components etc. Some of the methods of Component class are -
    void setForeground(Color c)
    void setBackground(Color c)
  • As the name indicates, these methods are used to set color of a component. The font of the text rendered can be changed using the setFont(Font f) method. By default all components except objects of type Window and its subclasses (Dialog and Frame) are visible. The visibility of a component can be changed using the setVisible method defined in the component class. The prototype of this method is
    void setVisible(boolean b);
  • Panel class does not have a title, menu or border. Applet class is used to run programs that run in a web browser.
  • Window class represents a top-level window. Both Window and Panel classes do not have title, menus or borders. The Window class is rarely used directly and its subclasses Frame and Dialog are more common.
  • The pack method defined in Window class initiates the layout manager of sub-components of the window.
  • The Frame class is a subclass of the Window class. It is used to create a GUI application window. Frames have title bars, icons and menus.

home | tutorial | questions | test 1