class Graphics  (Graphics context)

An abstract class representing a drawing surface of pixels onto which painting can occur.

The technical meaning of "abstract" is that objects of this class cannot be created using

new Graphics(...)

Instead, there are various specific  types of graphics that get created.


Example methods for Graphics

void drawRect(x,y,width,height)

Caution:  Rotated left-hand coordinate system.


void drawOval(int x,int y,int width,int height)

void drawString(String string,int x,int y)

x,y is the baseline  of the string, not the northwest corner

Link to source file testGraphics1.java (applet version).

To Next Slide To Previous Slide To Contents