Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Overview of AWT Classes 1
  2. 2. ObjectiveOn completion of this period, you would beable to know• Overview of AWT Classes 2
  3. 3. RecapIn the previous class, you have leant• The simple applet programs 3
  4. 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 4
  5. 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 5 5
  6. 6. AWT Classes contd..AWTEvent Encapsulates AWT eventsButton Creates a push button controlCanvas A blank, semantics-free windowCheckbox Creates a check box controlCheckboxGroup Creates a group of check box controlsCheckboxMenuItem Creates an on/off menu itemChoice Creates a pop-up list Manages colors in a portable, platform-independentColor fashionComponent An abstract superclass for various AWT components A subclass of Component that can hold otherContainer components 6
  7. 7. AWT Classes contd..Cursor Encapsulates a bitmapped cursorDialog Creates a dialog windowDimension Specifies the dimensions of an object, i.e. width and heightEvent Encapsulates eventsEventQueue Queues eventsFileDialog Creates a window from which a file can be selectedFont Encapsulates a type fontFontMetrics Encapsulates various information related to a font Creates a standard window that has a title bar, resizeFrame corners, and a menu barGraphics Encapsulates the graphics context. This context is 7
  8. 8. AWT Classes contd..Image Encapsulates graphical imagesInsets Encapsulates the borders of a containerLabel Creates a label that displays a string Creates a list from which the user can choose. Similar toList the standard Windows list boxMediaTracker Manages media objectsMenu Creates a pull-down menuMenuBar Creates a menu barMenuComponent An abstract class implemented by various menu classesMenuItem Creates a menu itemMenuShortcut Encapsulates a keyboard shortcut for a menu item 8
  9. 9. AWT Classes contd..Panel The simplest concrete subclass of ContainerPoint Encapsulates a Cartesian coordinate pair, stored in x and yPolygon Encapsulates a polygonPopupMenu Encapsulates a pop-up menuPrintJob An abstract class that represents a print jobRectangle Encapsulates a rectangleScrollbar Creates a scroll bar control A container that provides horizontal and/or vertical scroll barsScrollPane for another component Contains the colors of GUI widgets such as windows, scrollSystemColor bars, text, and othersTextField Creates a single-line edit control 9
  10. 10. AWT Classes contd..TextArea Creates a multiline edit controlTextComponen A superclass for TextArea and TextField tToolkit Abstract class implemented by the AWTWindow Creates a window with no frame, no menu bar, and no title 10
  11. 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 11
  12. 12. Summary• In this class we have discussed – The AWT classes – Listed AWT classes with proper description 12
  13. 13. Quiz1.Which of the following classes is not in awt package a) Button b) Thread c) Panel d) Menu 13
  14. 14. Quiz contd..2. Which of the following classes is not useful for user data entry a) TextField b) TextArea c) Label d) Choice 14
  15. 15. Frequently Asked Questions1. List the AWT classes that are useful for user data entry2. List the AWT classes for menu processing 15