O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

java.awt.Graphics

java.awt.Graphics is an abstract class that defines a veritable kitchen sink of graphical operations. Its 47 public methods can be used for rendering images and text, drawing and filling shapes, clipping graphical operations, and much more.

Nearly all applets (and applications) that use the AWT manipulate a Graphics for at least one graphical service. For example, even simple Hello World applets are quick to use a Graphics to display their clever verbiage:

public class HelloWorld extends Applet {
   public void paint(Graphics g) {
      g.drawString("Hello Graphic Java World", 75, 100);
   }
}

In addition to performing graphical operations within a component, each Graphics also keeps track of the following graphical properties:

  • The color ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required