Browse Source

Remove redundant check.

pull/188/head
weisj 4 years ago
parent
commit
082a9c475f
  1. 19
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java

19
core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java

@ -288,28 +288,19 @@ public class DarkButtonBorder implements Border, UIResource {
} }
public Insets getBorderInsets(final Component c) { public Insets getBorderInsets(final Component c) {
Insets margins = c instanceof AbstractButton ? ((AbstractButton) c).getMargin() : null;
if (ButtonConstants.isBorderlessRectangular(c)) { if (ButtonConstants.isBorderlessRectangular(c)) {
Insets ins = new InsetsUIResource(borderlessRectangularInsets.top, borderlessRectangularInsets.left, return new InsetsUIResource(borderlessRectangularInsets.top, borderlessRectangularInsets.left,
borderlessRectangularInsets.bottom, borderlessRectangularInsets.right); borderlessRectangularInsets.bottom, borderlessRectangularInsets.right);
return getInsets(ins, margins);
} }
boolean shadowVariant = ButtonConstants.isBorderlessVariant(c); boolean shadowVariant = ButtonConstants.isBorderless(c);
int shadow = shadowVariant ? 0 : getShadowSize(); int shadow = shadowVariant ? 0 : getShadowSize();
boolean square = ButtonConstants.isSquare(c); boolean square = ButtonConstants.isSquare(c);
Insets pad = ButtonConstants.isThin(c) ? square ? squareThinInsets Insets pad = ButtonConstants.isThin(c)
: thinInsets ? square ? squareThinInsets : thinInsets
: square ? squareInsets : square ? squareInsets : insets;
: insets;
pad = getInsets(pad, margins);
return maskInsets(new InsetsUIResource(pad.top, pad.left, pad.bottom, pad.right), c, shadow); return maskInsets(new InsetsUIResource(pad.top, pad.left, pad.bottom, pad.right), c, shadow);
} }
protected Insets getInsets(final Insets ins, final Insets margin) {
return ins;
}
protected Insets maskInsets(final Insets ins, final Component c, final int shadow) { protected Insets maskInsets(final Insets ins, final Component c, final int shadow) {
AlignmentExt alignment = getCornerFlag(c); AlignmentExt alignment = getCornerFlag(c);
if (alignment == null) return ins; if (alignment == null) return ins;

Loading…
Cancel
Save