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

The Graphics Coordinate System

The graphics coordinate system is anchored in the upper left-hand corner of a component, with coordinates increasing down and to the right, as depicted in Figure 3-1.

Figure 3-1. Graphics Coordinate System. Circles represent coordinates, and squares represent pixels. Coordinates lie between pixels.

Coordinates lie between pixels of the output device. Operations that draw outlines of shapes, such as Graphics.drawRect(), traverse a coordinate path with a pen that hangs beneath and to the right of the path. The size of the pen is always one pixel wide and one pixel high.

Drawing Shapes

Example 3-1 lists an applet that ...

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