diff --git a/src/java/com/samskivert/swing/MultiLineLabel.java b/src/java/com/samskivert/swing/MultiLineLabel.java index 422f3bc8..71ba8abd 100644 --- a/src/java/com/samskivert/swing/MultiLineLabel.java +++ b/src/java/com/samskivert/swing/MultiLineLabel.java @@ -386,7 +386,7 @@ public class MultiLineLabel extends JComponent protected int _constrainedSize; /** Whether to render the label with anti-aliasing. */ - protected boolean _antialiased; + protected boolean _antialiased = SwingUtil.getDefaultTextAntialiasing(); /** Whether this label is dirty and should be re-layed out. */ protected boolean _dirty = true; diff --git a/src/java/com/samskivert/swing/util/SwingUtil.java b/src/java/com/samskivert/swing/util/SwingUtil.java index 566d4869..a832b3a8 100644 --- a/src/java/com/samskivert/swing/util/SwingUtil.java +++ b/src/java/com/samskivert/swing/util/SwingUtil.java @@ -439,6 +439,16 @@ public class SwingUtil gfx.setRenderingHints((RenderingHints)rock); } + /** + * Returns true if anti-aliasing is desired by default. This currently checks the value of the + * swing.aatext property, but will someday switch to using Java Desktop Properties + * which in theory get their values from OS preferences. + */ + public static boolean getDefaultTextAntialiasing () + { + return _defaultTextAntialiasing; + } + /** * Adjusts the widths and heights of the cells of the supplied table to fit their contents. */ @@ -631,4 +641,14 @@ public class SwingUtil /** Used by {@link #addDebugBorders}. */ protected static Random _rando = new Random(); + + /** Used by {@link #getDefaultTextAntialiasing}. */ + protected static boolean _defaultTextAntialiasing; + static { + try { + _defaultTextAntialiasing = Boolean.getBoolean("swing.aatext"); + } catch (Exception e) { + // security exception due to running in a sandbox, no problem + } + } }