Yosemite LaF: fix background painting for text fields

This commit is contained in:
Konstantin Bulenkov
2015-08-19 20:50:24 +02:00
parent 1620435f81
commit ba3ad04aaf
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.Gray;
import com.intellij.util.ui.JBInsets;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.border.Border;
@@ -108,11 +109,26 @@ public class MacIntelliJTextFieldUI extends TextFieldWithPopupHandlerUI {
if (isSearchField(c)) {
paintSearchField(g, c, r);
} else {
super.paintBackground(g);
if (c.getBorder() instanceof MacIntelliJTextBorder) {
g.setColor(c.getBackground());
g.fillRect(3, 3, c.getWidth() - 6, c.getHeight() - 6);
} else {
super.paintBackground(g);
}
}
config.restore();
}
@NotNull
@Override
public Dimension getPreferredSize(JComponent c) {
Dimension size = super.getPreferredSize(c);
if (c.getBorder() instanceof MacIntelliJTextBorder) {
return new Dimension(size.width + 8, 26);
}
return size;
}
protected void paintDarculaBackground(Graphics2D g, JTextComponent c, Border border) {
if (c.isEnabled() && c.isEditable()) {
g.setColor(c.getBackground());