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.