From 195c16e06ab32fc90c8c450c10006e886f49eb81 Mon Sep 17 00:00:00 2001 From: mdb Date: Fri, 29 Feb 2008 20:11:03 +0000 Subject: [PATCH] It used to be that if you created a TextLayout with a font render context that indicated the use of antialiasing, rendering that TextLayout would render with antialiasing. However, it seems that some JVMs don't do that, so we need to manually enable antialiasing before rendering the TextLayout. Such are the millions of tiny inconsistencies that undermine write once run anywhere. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2276 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/swing/MultiLineLabel.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/java/com/samskivert/swing/MultiLineLabel.java b/src/java/com/samskivert/swing/MultiLineLabel.java index f7959c76..e048b131 100644 --- a/src/java/com/samskivert/swing/MultiLineLabel.java +++ b/src/java/com/samskivert/swing/MultiLineLabel.java @@ -3,7 +3,7 @@ // // samskivert library - useful routines for java programs // Copyright (C) 2001-2007 Michael Bayne -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -30,6 +30,8 @@ import javax.swing.JComponent; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; +import com.samskivert.swing.util.SwingUtil; + /** * A Swing component that displays a {@link Label}. */ @@ -248,7 +250,14 @@ public class MultiLineLabel extends JComponent } // draw the label + Object oalias = null; + if (_antialiased) { + oalias = SwingUtil.activateAntiAliasing(gfx); + } _label.render(gfx, dx, dy); + if (_antialiased) { + SwingUtil.restoreAntiAliasing(gfx, oalias); + } } // documentation inherited