avoid painting text with our rendering hints enabled to avoid antialiased text in some components if text antialiasing is disabled in system (issue #227)

This commit is contained in:
Karl Tauber
2020-12-18 12:17:43 +01:00
parent 460f0d9dee
commit 956001dbd7
13 changed files with 237 additions and 45 deletions

View File

@@ -60,13 +60,6 @@ public class FlatHyperlinkUI
disabledText = null;
}
@Override
public void paint( Graphics g, JComponent c ) {
FlatUIUtils.setRenderingHints( (Graphics2D) g );
super.paint( g, c );
}
@Override
protected void paintText( Graphics g, AbstractButton b, Rectangle textRect, String text ) {
FlatButtonUI.paintText( g, b, textRect, text, b.isEnabled() ? b.getForeground() : disabledText );
@@ -78,8 +71,12 @@ public class FlatHyperlinkUI
private void paintUnderline( Graphics g, Rectangle rect ) {
int descent = g.getFontMetrics().getDescent();
Object[] oldRenderingHints = FlatUIUtils.setRenderingHints( g );
((Graphics2D)g).fill( new Rectangle2D.Float(
rect.x, (rect.y + rect.height) - descent + UIScale.scale( 1f ),
rect.width, UIScale.scale( 1f ) ) );
FlatUIUtils.resetRenderingHints( g, oldRenderingHints );
}
}