AWT Classes in Java

AWT Graphics class:

AWT Graphics class includes methods for drawing many different types of shapes. To draw a shape, we may call one of the methods available in the AWT Graphics class.

Drawing Method Description
clearRect()It erases a rectangular area of the canvas.
copyArea()It copies a rectangular area of the canvas to another area.
drawArc()It draws a hollow arc.
drawLine()It draws a straight line.
drawOval()It draws a hollow oval.
drawPolygon()It draws a hollow polygon.
drawRect()It draws a hollow rectangle.
drawRoundRect()It draws a hollow rectangle with rounded corners.
drawstring()It draws a text string.
fillArc()It draws a filled arc.
fillOval()It draws a filled oval.
fillPolygon()It draws a filled polygon.
fillRect()It draws a filled rectangle.
fillRoundRect()It draws a filled rectangle with rounded corners.
getColor()It retrieves the current drawing color.
getFont()It retrieves the currently used font.
getFontMetrics()It retrieves information about the current font.
setColor()It sets the drawing color.
setFont()It sets the font.

AWT Hierarchy:

The Abstract Window Toolkit (AWT) package in Java enables the programming to create GUI-based applications. It contains several classes that help to implement common window-based tasks. such as windows, adding scroll bar, buttons, list items, text boxes, etc. All the classes are contained in the java.awt package. These classes are hierarchically arranged inside the AWT package. AWT provides support for both standard and applet windows.

AWT Hierarchy

Recommended Posts:

Advanced Java
    1. Java Applet
    2. Applet Life Cycle in Java
    3. Difference Between Applet and Application
    4. Creating an Executable Applet in Java
    5. Displaying Numerical values in Applet
    6. An Applet Program to Add Two Numbers
    7. Event Handling in Applet
    8. AWT Event Classes
    9. AWT Graphics Class
    10. Draw a line and rectangle in Java Applet
    11. Draw Circles and Ellipses in Java Applet
    12. Draw a Polygon in Java Applet
    13. AWT Hierarchy | AWT Package
    14. Swing in Core Java