Troubleshooting
Justifying Text
How do I left-, center-, right-, and equally- (both left and right) justify text using Java 2D's AttributedString , LineBreakMeasurer , and TextLayout classes?
Sun's online Java 2D text tutorial discusses justification. You can read this tutorial, by pointing your browser to the following Web address:
Listing 18.30 presents source code to a Justify application that demonstrates left-, center-, right-, and equality-justification. (Set the justify variable to the appropriate justification constant and watch the results.)
Code Listing 18.30. The Justify Application Source Code
// Justify.java import java.awt.*; ... |
Get Special Edition Using Java 2 Standard 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.