Set font to Graphics in DarculaButtonUI

GitOrigin-RevId: f4687ae2db958d56995604e1410e9bbfa2d03de4
This commit is contained in:
Kirill Kirichenko
2019-06-11 18:05:58 +03:00
committed by intellij-monorepo-bot
parent 56d7011548
commit 5ac4802e3b
2 changed files with 6 additions and 8 deletions
@@ -260,16 +260,14 @@ public class DarculaButtonUI extends BasicButtonUI {
@Override
public void update(Graphics g, JComponent c) {
setupDefaultButton(c, g);
super.update(g, c);
setupDefaultButton((JButton)c);
}
protected void setupDefaultButton(JButton button) {
if (!SystemInfo.isMac) {
Font f = new FontUIResource(isDefaultButton(button) ?
button.getFont().deriveFont(Font.BOLD) :
button.getFont().deriveFont(Font.PLAIN));
button.setFont(f);
protected void setupDefaultButton(JComponent button, Graphics g) {
Font f = button.getFont();
if (!SystemInfo.isMac && f instanceof FontUIResource) {
g.setFont(isDefaultButton(button) ? f.deriveFont(Font.BOLD) : f.deriveFont(Font.PLAIN));
}
}
@@ -101,7 +101,7 @@ public class WinIntelliJButtonUI extends DarculaButtonUI {
}
@Override
protected void setupDefaultButton(JButton button) {}
protected void setupDefaultButton(JComponent button, Graphics g) {}
@Override
protected void paintDisabledText(Graphics g, String text, JComponent c, Rectangle textRect, FontMetrics metrics) {