Summary

The AWT provides two color models: index color models and direct color models. Index color models interpret pixel values as indices into a colormap, whereas direct color models directly interpret the bits in a pixel value.

Colors are represented by the java.awt.Color class, which provides a set of constants for commonly used colors, in addition to convenience methods for obtaining darker and lighter shades of a color, comparing two colors for equality, etc.

Fonts are represented by the java.awt.Font class, which allows the construction of fonts by specifying a logical font name, style, and point size. Logical font names are always mapped onto native fonts so, for instance, a SanSerif logical name will map to different fonts on different ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.