mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DBE: fix darcula button offsets
This commit is contained in:
+4
-5
@@ -31,13 +31,12 @@ import java.awt.*;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class DarculaButtonPainter implements Border, UIResource {
|
||||
private static final int myOffset = 4;
|
||||
private static final int myOffset = 1;
|
||||
|
||||
@Override
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||
final Graphics2D g2d = (Graphics2D)g;
|
||||
final Insets ins = getBorderInsets(c);
|
||||
final int yOff = (ins.top + ins.bottom) / 4;
|
||||
final int yOff = 1;
|
||||
final boolean square = DarculaButtonUI.isSquare(c);
|
||||
int offset = JBUI.scale(square ? 1 : getOffset());
|
||||
int w = c.getWidth();
|
||||
@@ -48,7 +47,7 @@ public class DarculaButtonPainter implements Border, UIResource {
|
||||
if (DarculaButtonUI.isHelpButton((JComponent)c)) {
|
||||
DarculaUIUtil.paintFocusOval(g2d, (w - diam) / 2, (h - diam) / 2, diam, diam);
|
||||
} else {
|
||||
DarculaUIUtil.paintFocusRing(g2d, offset, yOff, width - 2 * offset, height - 2 * yOff);
|
||||
DarculaUIUtil.paintFocusRing(g2d, offset + 1, yOff + 1, width - 2 * offset - 2, height - 2 * yOff - 2);
|
||||
}
|
||||
} else {
|
||||
final GraphicsConfig config = new GraphicsConfig(g);
|
||||
@@ -75,7 +74,7 @@ public class DarculaButtonPainter implements Border, UIResource {
|
||||
if (DarculaButtonUI.isSquare(c)) {
|
||||
return JBUI.insets(2, 0, 2, 0).asUIResource();
|
||||
}
|
||||
return JBUI.insets(8, 16, 8, 14).asUIResource();
|
||||
return JBUI.insets(5, 13, 5, 11).asUIResource();
|
||||
}
|
||||
|
||||
protected int getOffset() {
|
||||
|
||||
@@ -61,8 +61,7 @@ public class DarculaButtonUI extends BasicButtonUI {
|
||||
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
|
||||
final boolean square = isSquare(c);
|
||||
if (c.isEnabled() && border != null) {
|
||||
final Insets ins = border.getBorderInsets(c);
|
||||
final int yOff = (ins.top + ins.bottom) / 4;
|
||||
final int yOff = 1;
|
||||
if (!square) {
|
||||
if (c instanceof JButton && ((JButton)c).isDefaultButton()) {
|
||||
((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, getSelectedButtonColor1(), 0, h, getSelectedButtonColor2()));
|
||||
@@ -72,7 +71,7 @@ public class DarculaButtonUI extends BasicButtonUI {
|
||||
}
|
||||
}
|
||||
int rad = JBUI.scale(square ? 3 : 5);
|
||||
g.fillRoundRect(JBUI.scale(square ? 2 : 4), yOff, w - 2 * JBUI.scale(4), h - 2 * yOff, rad, rad);
|
||||
g.fillRoundRect(JBUI.scale(2), yOff, w - 2 * JBUI.scale(square ? 4 : 1), h - 2 * yOff, rad, rad);
|
||||
}
|
||||
config.restore();
|
||||
super.paint(g, c);
|
||||
|
||||
Reference in New Issue
Block a user