diff --git a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java
index b6ccede3ea81..25737046533a 100644
--- a/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java
+++ b/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.java
@@ -39,6 +39,7 @@ import com.intellij.util.xmlb.annotations.Property;
import com.intellij.util.xmlb.annotations.Transient;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
+import sun.swing.SwingUtilities2;
import javax.swing.*;
import java.awt.*;
@@ -276,7 +277,10 @@ public class UISettings extends SimpleModificationTracker implements PersistentS
}
}
- /* This method must not be used for set up antialiasing for editor components
+ /**
+ * This method must not be used for set up antialiasing for editor components. To make sure antialiasing settings are taken into account
+ * when preferred size of component is calculated, {@link #setupComponentAntialiasing(JComponent)} method should be called from
+ * updateUI() or setUI() method of component.
*/
public static void setupAntialiasing(final Graphics g) {
@@ -301,4 +305,11 @@ public class UISettings extends SimpleModificationTracker implements PersistentS
setupFractionalMetrics(g2d);
}
+
+ /**
+ * @see #setupComponentAntialiasing(JComponent)
+ */
+ public static void setupComponentAntialiasing(JComponent component) {
+ component.putClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY, AntialiasingType.getAAHintForSwingComponent());
+ }
}
\ No newline at end of file
diff --git a/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java b/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java
index 1ae9ace0da3f..1a99262a5fcf 100644
--- a/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java
+++ b/platform/platform-api/src/com/intellij/ui/SimpleColoredComponent.java
@@ -123,6 +123,12 @@ public class SimpleColoredComponent extends JComponent implements Accessible, Co
myFragmentPadding = new TIntIntHashMap(10);
myFragmentAlignment = new TIntIntHashMap(10);
setOpaque(true);
+ updateUI();
+ }
+
+ @Override
+ public void updateUI() {
+ UISettings.setupComponentAntialiasing(this);
}
@NotNull