Download the JDK
Search the Tutorials
Hide the TOC
Working with Text APIs
Selecting a Font
Measuring Text
Advanced Text Display
Displaying Antialiased Text by Using Rendering Hints
Using Text Attributes to Style Text
Drawing Multiple Lines of Text
Trail: 2D Graphics
« Previous • Trail • Next »
Lesson: Working with Text APIs

> This lesson introduces you to the concept of working with text API’s to apply text rendering capabilities. Already in this trail, you have used basic Java 2D™ text APIs and know how to set a font and position, and how to draw text.

> This lesson expands on that material to help you develop an understanding of how to use those APIs and moves further into the capabilities of Java 2D text display.

> These topics are discussed in the following sections.

> ### Selecting a font

> > This section explains how to use the methods of the `Font` class to determine which fonts are available on your system, to create a `Font` object, and obtain information about a font family.

> ### Measuring Text

> > This section explains how to properly measure text by using an instance of the `FontMetrics` class.

> ### Advanced Text Display

> > This section explains how to position and render a paragraph of styled text, how to display antialiased text, and how to use text attributes to style text.

« Previous • Trail • Next »
Previous page: Previous Lesson
Next page: Selecting a Font