Browse Source

Renamed fullBorderless -> borderlessRectangular.

pull/127/head
weisj 5 years ago
parent
commit
658667b931
  1. 8
      core/src/main/java/com/github/weisj/darklaf/ui/button/ButtonConstants.java
  2. 11
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java
  3. 14
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  4. 2
      core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkDesktopIconUI.java
  5. 2
      core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameTitlePane.java
  6. 2
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties
  7. 2
      core/src/test/java/ui/button/ButtonDemo.java
  8. 2
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

8
core/src/main/java/com/github/weisj/darklaf/ui/button/ButtonConstants.java

@ -42,7 +42,7 @@ public interface ButtonConstants {
String KEY_TOP_NEIGHBOUR = "JButton.topNeighbour";
String KEY_BOTTOM_NEIGHBOUR = "JButton.bottomNeighbour";
String VARIANT_ONLY_LABEL = "onlyLabel";
String VARIANT_FULL_BORDERLESS = "fullBorderless";
String VARIANT_BORDERLESS_RECTANGULAR = "borderlessRectangular";
String VARIANT_BORDERLESS = "borderless";
String VARIANT_NONE = "none";
@ -74,7 +74,7 @@ public interface ButtonConstants {
}
static boolean isBorderlessVariant(final Component c) {
if (isFullBorderless(c)) return true;
if (isBorderlessRectangular(c)) return true;
if (c instanceof JButton) {
JButton b = (JButton) c;
return doConvertToBorderless((AbstractButton) c) || VARIANT_BORDERLESS.equals(
@ -83,9 +83,9 @@ public interface ButtonConstants {
return false;
}
static boolean isFullBorderless(final Component c) {
static boolean isBorderlessRectangular(final Component c) {
return c instanceof AbstractButton
&& VARIANT_FULL_BORDERLESS.equals(((AbstractButton) c).getClientProperty(KEY_VARIANT));
&& VARIANT_BORDERLESS_RECTANGULAR.equals(((AbstractButton) c).getClientProperty(KEY_VARIANT));
}
static boolean doConvertToBorderless(final AbstractButton b) {

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

@ -59,7 +59,7 @@ public class DarkButtonBorder implements Border, UIResource {
private Insets squareInsets;
private Insets squareThinInsets;
private Insets labelInsets;
private Insets shadowInsets;
private Insets borderlessRectangularInsets;
public DarkButtonBorder() {
shadowColor = UIManager.getColor("Button.shadow");
@ -79,12 +79,12 @@ public class DarkButtonBorder implements Border, UIResource {
squareInsets = UIManager.getInsets("Button.squareBorderInsets");
squareThinInsets = UIManager.getInsets("Button.squareThinBorderInsets");
labelInsets = UIManager.getInsets("Button.onlyLabelInsets");
shadowInsets = UIManager.getInsets("Button.fullBorderlessInsets");
borderlessRectangularInsets = UIManager.getInsets("Button.borderlessRectangularInsets");
if (insets == null) insets = new Insets(0, 0, 0, 0);
if (thinInsets == null) thinInsets = new Insets(0, 0, 0, 0);
if (squareThinInsets == null) squareThinInsets = new Insets(0, 0, 0, 0);
if (squareInsets == null) squareInsets = new Insets(0, 0, 0, 0);
if (shadowInsets == null) shadowInsets = new Insets(0, 0, 0, 0);
if (borderlessRectangularInsets == null) borderlessRectangularInsets = new Insets(0, 0, 0, 0);
if (labelInsets == null) labelInsets = new Insets(0, 0, 0, 0);
}
@ -263,8 +263,9 @@ public class DarkButtonBorder implements Border, UIResource {
}
public Insets getBorderInsets(final Component c) {
if (ButtonConstants.isFullBorderless(c)) {
return new InsetsUIResource(shadowInsets.top, shadowInsets.left, shadowInsets.bottom, shadowInsets.right);
if (ButtonConstants.isBorderlessRectangular(c)) {
return new InsetsUIResource(borderlessRectangularInsets.top, borderlessRectangularInsets.left,
borderlessRectangularInsets.bottom, borderlessRectangularInsets.right);
}
if (ButtonConstants.isLabelButton(c)) {
return new InsetsUIResource(labelInsets.top, labelInsets.left, labelInsets.bottom, labelInsets.right);

14
core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java

@ -61,8 +61,8 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
protected Color hoverBackground;
protected Color clickBackground;
protected Color inactiveBackground;
protected Color shadowHover;
protected Color shadowClick;
protected Color borderlessHover;
protected Color borderlessClick;
protected AbstractButton button;
protected int arc;
protected int squareArc;
@ -105,8 +105,8 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
hoverBackground = UIManager.getColor("Button.activeFillColorRollOver");
clickBackground = UIManager.getColor("Button.activeFillColorClick");
inactiveBackground = UIManager.getColor("Button.inactiveFillColor");
shadowHover = UIManager.getColor("Button.borderless.hover");
shadowClick = UIManager.getColor("Button.borderless.click");
borderlessHover = UIManager.getColor("Button.borderless.hover");
borderlessClick = UIManager.getColor("Button.borderless.click");
arc = UIManager.getInt("Button.arc");
squareArc = UIManager.getInt("Button.squareArc");
}
@ -223,7 +223,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
if (b.isEnabled() && b.getModel().isRollover()) {
GraphicsUtil.setupAAPainting(g2);
g.setColor(getShadowColor(b));
if (ButtonConstants.isFullBorderless(c)) {
if (ButtonConstants.isBorderlessRectangular(c)) {
g.fillRect(margin.left, margin.top,
width - margin.left - margin.right,
height - margin.top - margin.bottom);
@ -345,8 +345,8 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
protected Color getShadowColor(final AbstractButton c) {
Object colorHover = c.getClientProperty(KEY_HOVER_COLOR);
Object colorClick = c.getClientProperty(KEY_CLICK_COLOR);
return c.getModel().isArmed() ? colorClick instanceof Color ? (Color) colorClick : shadowClick
: colorHover instanceof Color ? (Color) colorHover : shadowHover;
return c.getModel().isArmed() ? colorClick instanceof Color ? (Color) colorClick : borderlessClick
: colorHover instanceof Color ? (Color) colorHover : borderlessHover;
}
protected String layout(final AbstractButton b, final JComponent c, final FontMetrics fm,

2
core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkDesktopIconUI.java

@ -56,7 +56,7 @@ public class DarkDesktopIconUI extends BasicDesktopIconUI {
button = new JButtonUIResource(title, icon);
button.setOpaque(false);
button.setFocusable(false);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_FULL_BORDERLESS);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS_RECTANGULAR);
button.putClientProperty(DarkButtonUI.KEY_HOVER_COLOR, UIManager.getColor("DesktopIcon.hoverColor"));
button.putClientProperty(DarkButtonUI.KEY_CLICK_COLOR, UIManager.getColor("DesktopIcon.hoverColor"));
button.setRolloverEnabled(true);

2
core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameTitlePane.java

@ -214,7 +214,7 @@ public class DarkInternalFrameTitlePane extends BasicInternalFrameTitlePane {
};
button.setFocusable(false);
button.setOpaque(true);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_FULL_BORDERLESS);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS_RECTANGULAR);
button.putClientProperty("paintActive", Boolean.TRUE);
button.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, accessibleName);
button.setText(null);

2
core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties

@ -52,7 +52,7 @@ Button.thinBorderInsets = 4,8,4,8
Button.squareThinBorderInsets = 4,4,4,4
Button.squareBorderInsets = 6,6,6,6
Button.onlyLabelInsets = 0,0,0,0
Button.fullBorderlessInsets = 0,0,0,0
Button.borderlessRectangularInsets = 0,0,0,0
Button.borderless.hover = %hoverHighlight
Button.borderless.click = %clickHighlight

2
core/src/test/java/ui/button/ButtonDemo.java

@ -93,7 +93,7 @@ public class ButtonDemo implements ComponentDemo {
controlPanel.add(new JComboBox<String>() {{
addItem(DarkButtonUI.VARIANT_NONE);
addItem(DarkButtonUI.VARIANT_BORDERLESS);
addItem(DarkButtonUI.VARIANT_FULL_BORDERLESS);
addItem(DarkButtonUI.VARIANT_BORDERLESS_RECTANGULAR);
addItem(DarkButtonUI.VARIANT_ONLY_LABEL);
setSelectedItem(DarkButtonUI.VARIANT_NONE);
addItemListener(e -> button.putClientProperty(DarkButtonUI.KEY_VARIANT, e.getItem()));

2
windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

@ -153,7 +153,7 @@ public class WindowsTitlePane extends CustomTitlePane {
button.setFocusable(false);
button.setOpaque(true);
button.setRolloverEnabled(true);
button.putClientProperty("JButton.variant", "fullBorderless");
button.putClientProperty("JButton.variant", "borderlessRectangular");
button.putClientProperty("paintActive", Boolean.TRUE);
button.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, accessibleName);
button.setAction(action);

Loading…
Cancel
Save