Chapter 15. Graphics and Java 2D

One picture is worth ten thousand words.

Chinese proverb

Treat nature in terms of the cylinder, the sphere, the cone, all in perspective.

Paul Cézanne

Colors, like features, follow the changes of the emotions.

Pablo Picasso

Nothing ever becomes real till it is experienced—even a proverb is no proverb to you till your life has illustrated it.

John Keats


In this chapter you’ll learn:

• To understand graphics contexts and graphics objects.

• To manipulate colors and fonts.

• To use methods of class Graphics to draw various shapes.

• To use methods of class Graphics2D from the Java 2D API to draw various shapes.

• To specify Paint and Stroke characteristics of shapes displayed with Graphics2D ...

Get Java™ for Programmers: Deitel Developer Series, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.