Drawing Text

The Font class of java.awt provides a platform-independent method of specifying and using fonts. The Font class constructor creates Font objects using the font's name, style (PLAIN, BOLD, ITALIC, or BOLD + ITALIC), and point size. Java's fonts are named in a platform-independent manner and then mapped to local fonts that are supported by the operating system on which it executes. The getName() method returns the logical Java font name of a particular font, and the getFamily() method returns the operating system-specific name of the font. You will learn the name of the standard Java fonts in the next programming example of this chapter.

The FontMetrics class returns the specific parameters for a partic-ular Font object. An object ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams 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.