Browse Source

renamed "shadow" variant to "borderless". "fullBorderless" is still WIP.

Fixed incorrect pressed icon for windows title pane.
pull/127/head
weisj 5 years ago
parent
commit
e0791cac28
  1. 2
      core/src/main/java/com/github/weisj/darklaf/components/ArrowButton.java
  2. 2
      core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java
  3. 33
      core/src/main/java/com/github/weisj/darklaf/ui/button/ButtonConstants.java
  4. 8
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java
  5. 16
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  6. 6
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUI.java
  7. 2
      core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkDesktopIconUI.java
  8. 2
      core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameTitlePane.java
  9. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/NewTabButton.java
  10. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkPanelPopupUI.java
  11. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabbedPopupUI.java
  12. 2
      core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/DarkToggleButtonUI.java
  13. 12
      core/src/main/resources/com/github/weisj/darklaf/properties/overwrites.properties
  14. 66
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties
  15. 6
      core/src/test/java/UIDemo.java
  16. 4
      core/src/test/java/ui/button/ButtonDemo.java
  17. 12
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

2
core/src/main/java/com/github/weisj/darklaf/components/ArrowButton.java

@ -72,7 +72,7 @@ public final class ArrowButton implements SwingConstants {
final boolean applyInsetsOnSize, final Insets insets) {
return new BasicArrowButton(orientation, null, null, null, null) {
{
putClientProperty(DarkButtonUI.KEY_NO_SHADOW_OVERWRITE, true);
putClientProperty(DarkButtonUI.KEY_NO_BORDERLESS_OVERWRITE, true);
}
@Override

2
core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java

@ -80,7 +80,7 @@ public class ClosableTabComponent extends JPanel {
protected TabButton(final ClosableTabComponent tabComponent) {
this.tabComponent = tabComponent;
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_ONLY_LABEL);
putClientProperty(DarkButtonUI.KEY_NO_SHADOW_OVERWRITE, true);
putClientProperty(DarkButtonUI.KEY_NO_BORDERLESS_OVERWRITE, true);
setOpaque(false);
setRolloverEnabled(true);
setIcon(UIManager.getIcon("TabbedPane.tabCloseIcon"));

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

@ -29,21 +29,21 @@ import java.awt.*;
public interface ButtonConstants {
String KEY_VARIANT = "JButton.variant";
String KEY_HOVER_COLOR = "JButton.shadow.hover";
String KEY_CLICK_COLOR = "JButton.shadow.click";
String KEY_HOVER_COLOR = "JButton.borderless.hover";
String KEY_CLICK_COLOR = "JButton.borderless.click";
String KEY_ALT_ARC = "JButton.alternativeArc";
String KEY_NO_ARC = "JButton.noArc";
String KEY_SQUARE = "JButton.square";
String KEY_THIN = "JButton.thin";
String KEY_NO_SHADOW_OVERWRITE = "JButton.noShadowOverwrite";
String KEY_NO_BORDERLESS_OVERWRITE = "JButton.noBorderlessOverwrite";
String KEY_CORNER = "JButton.cornerFlag";
String KEY_LEFT_NEIGHBOUR = "JButton.leftNeighbour";
String KEY_RIGHT_NEIGHBOUR = "JButton.rightNeighbour";
String KEY_TOP_NEIGHBOUR = "JButton.topNeighbour";
String KEY_BOTTOM_NEIGHBOUR = "JButton.bottomNeighbour";
String VARIANT_ONLY_LABEL = "onlyLabel";
String VARIANT_FULL_SHADOW = "fullShadow";
String VARIANT_SHADOW = "shadow";
String VARIANT_FULL_BORDERLESS = "fullBorderless";
String VARIANT_BORDERLESS = "borderless";
String VARIANT_NONE = "none";
static boolean chooseAlternativeArc(final Component c) {
@ -68,33 +68,34 @@ public interface ButtonConstants {
static boolean isThin(final Component c) {
if (c instanceof AbstractButton) {
boolean isThin = Boolean.TRUE.equals(((AbstractButton) c).getClientProperty(KEY_THIN));
return isThin || ButtonConstants.doConvertToShadow((AbstractButton) c);
return isThin || ButtonConstants.doConvertToBorderless((AbstractButton) c);
}
return false;
}
static boolean isShadowVariant(final Component c) {
if (isFullShadow(c)) return true;
static boolean isBorderlessVariant(final Component c) {
if (isFullBorderless(c)) return true;
if (c instanceof JButton) {
JButton b = (JButton) c;
return doConvertToShadow((AbstractButton) c) || VARIANT_SHADOW.equals(b.getClientProperty(KEY_VARIANT));
return doConvertToBorderless((AbstractButton) c) || VARIANT_BORDERLESS.equals(
b.getClientProperty(KEY_VARIANT));
}
return false;
}
static boolean isFullShadow(final Component c) {
static boolean isFullBorderless(final Component c) {
return c instanceof AbstractButton
&& VARIANT_FULL_SHADOW.equals(((AbstractButton) c).getClientProperty(KEY_VARIANT));
&& VARIANT_FULL_BORDERLESS.equals(((AbstractButton) c).getClientProperty(KEY_VARIANT));
}
static boolean doConvertToShadow(final AbstractButton b) {
return isIconOnly(b) && !b.isFocusable() && convertIconButtonToShadow(b) && (b instanceof JButton);
static boolean doConvertToBorderless(final AbstractButton b) {
return isIconOnly(b) && !b.isFocusable() && convertIconButtonToBorderless(b) && (b instanceof JButton);
}
static boolean convertIconButtonToShadow(final AbstractButton b) {
static boolean convertIconButtonToBorderless(final AbstractButton b) {
return !(b instanceof UIResource)
&& UIManager.getBoolean("Button.convertIconOnlyToShadow")
&& !Boolean.TRUE.equals(b.getClientProperty(KEY_NO_SHADOW_OVERWRITE));
&& UIManager.getBoolean("Button.convertIconOnlyToBorderless")
&& !Boolean.TRUE.equals(b.getClientProperty(KEY_NO_BORDERLESS_OVERWRITE));
}
static boolean isIconOnly(final AbstractButton b) {

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

@ -79,7 +79,7 @@ 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.fullShadowInsets");
shadowInsets = UIManager.getInsets("Button.fullBorderlessInsets");
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);
@ -140,7 +140,7 @@ public class DarkButtonBorder implements Border, UIResource {
@Override
public void paintBorder(final Component c, final Graphics g,
final int x, final int y, final int width, final int height) {
if (ButtonConstants.isShadowVariant(c) || ButtonConstants.isLabelButton(c)) {
if (ButtonConstants.isBorderlessVariant(c) || ButtonConstants.isLabelButton(c)) {
return;
}
Graphics2D g2 = (Graphics2D) g;
@ -263,13 +263,13 @@ public class DarkButtonBorder implements Border, UIResource {
}
public Insets getBorderInsets(final Component c) {
if (ButtonConstants.isFullShadow(c)) {
if (ButtonConstants.isFullBorderless(c)) {
return new InsetsUIResource(shadowInsets.top, shadowInsets.left, shadowInsets.bottom, shadowInsets.right);
}
if (ButtonConstants.isLabelButton(c)) {
return new InsetsUIResource(labelInsets.top, labelInsets.left, labelInsets.bottom, labelInsets.right);
}
boolean shadowVariant = ButtonConstants.isShadowVariant(c);
boolean shadowVariant = ButtonConstants.isBorderlessVariant(c);
int shadow = shadowVariant ? 0 : getShadowSize();
boolean square = ButtonConstants.isSquare(c);
Insets pad = ButtonConstants.isThin(c) ? square ? squareThinInsets

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

@ -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.shadow.hover");
shadowClick = UIManager.getColor("Button.shadow.click");
shadowHover = UIManager.getColor("Button.borderless.hover");
shadowClick = UIManager.getColor("Button.borderless.click");
arc = UIManager.getInt("Button.arc");
squareArc = UIManager.getInt("Button.squareArc");
}
@ -175,7 +175,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
int height = c.getHeight();
Insets margin = b.getMargin();
if (margin instanceof UIResource) margin = new Insets(0, 0, 0, 0);
if (ButtonConstants.isShadowVariant(c)) {
if (ButtonConstants.isBorderlessVariant(c)) {
paintShadowBackground(g, c, g2, b, arc, width, height, margin);
} else {
paintDefaultBackground((Graphics2D) g, b, g2, arc, width, height);
@ -223,11 +223,11 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
if (b.isEnabled() && b.getModel().isRollover()) {
GraphicsUtil.setupAAPainting(g2);
g.setColor(getShadowColor(b));
if (ButtonConstants.isFullShadow(c)) {
if (ButtonConstants.isFullBorderless(c)) {
g.fillRect(margin.left, margin.top,
width - margin.left - margin.right,
height - margin.top - margin.bottom);
} else if (ButtonConstants.doConvertToShadow(b)) {
} else if (ButtonConstants.doConvertToBorderless(b)) {
int size = Math.min(width - margin.left - margin.right,
height - margin.left - margin.right);
g.fillRoundRect((width - size) / 2, (height - size) / 2, size, size, arc, arc);
@ -304,7 +304,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
Color fg = button.getForeground();
if (fg instanceof UIResource
&& ButtonConstants.isDefaultButton(button)
&& !ButtonConstants.isShadowVariant(button)) {
&& !ButtonConstants.isBorderlessVariant(button)) {
fg = defaultForeground;
}
if (fg instanceof UIResource && !button.getModel().isEnabled()) {
@ -316,7 +316,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
protected Color getBackgroundColor(final JComponent c) {
boolean defaultButton = ButtonConstants.isDefaultButton(c);
AbstractButton b = (AbstractButton) c;
boolean rollOver = (b.isRolloverEnabled() || ButtonConstants.doConvertToShadow(b))
boolean rollOver = (b.isRolloverEnabled() || ButtonConstants.doConvertToBorderless(b))
&& (((JButton) c).getModel().isRollover());
boolean clicked = b.getModel().isArmed();
if (c.isEnabled()) {
@ -352,7 +352,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
protected String layout(final AbstractButton b, final JComponent c, final FontMetrics fm,
final int width, final int height) {
Insets i = b.getInsets();
if (!ButtonConstants.isShadowVariant(b)) {
if (!ButtonConstants.isBorderlessVariant(b)) {
i = new Insets(i.top, borderSize, i.bottom, borderSize);
}

6
core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUI.java

@ -76,12 +76,12 @@ public class DarkFileChooserUI extends DarkFileChooserUIBridge {
buttonPanel.setLayout(new DarkButtonAreaLayout());
approveButton = new TooltipAwareButton(getApproveButtonText(fileChooser));
approveButton.putClientProperty(DarkButtonUI.KEY_NO_SHADOW_OVERWRITE, true);
approveButton.putClientProperty(DarkButtonUI.KEY_NO_BORDERLESS_OVERWRITE, true);
approveButton.addActionListener(getApproveSelectionAction());
approveButton.setToolTipText(getApproveButtonToolTipText(fileChooser));
cancelButton = new TooltipAwareButton(cancelButtonText);
cancelButton.putClientProperty(DarkButtonUI.KEY_NO_SHADOW_OVERWRITE, true);
cancelButton.putClientProperty(DarkButtonUI.KEY_NO_BORDERLESS_OVERWRITE, true);
cancelButton.setToolTipText(cancelButtonToolTipText);
cancelButton.addActionListener(getCancelSelectionAction());
@ -315,7 +315,7 @@ public class DarkFileChooserUI extends DarkFileChooserUIBridge {
}
protected void setupButton(final AbstractButton button, final String accessibleName, final String tipText) {
button.putClientProperty(DarkButtonUI.KEY_NO_SHADOW_OVERWRITE, true);
button.putClientProperty(DarkButtonUI.KEY_NO_BORDERLESS_OVERWRITE, true);
button.putClientProperty(DarkButtonUI.KEY_SQUARE, true);
button.putClientProperty(DarkButtonUI.KEY_ALT_ARC, true);
button.putClientProperty(DarkButtonUI.KEY_SQUARE, Boolean.TRUE);

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_SHADOW);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_FULL_BORDERLESS);
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_SHADOW);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_FULL_BORDERLESS);
button.putClientProperty("paintActive", Boolean.TRUE);
button.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, accessibleName);
button.setText(null);

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/NewTabButton.java

@ -53,7 +53,7 @@ public class NewTabButton extends JPanel implements UIResource {
JButton button = new JButtonUIResource();
button.setIcon(ui.getNewTabIcon());
button.setFocusable(false);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_SHADOW);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS);
button.putClientProperty(DarkButtonUI.KEY_SQUARE, Boolean.TRUE);
button.putClientProperty(DarkButtonUI.KEY_ALT_ARC, Boolean.TRUE);
button.putClientProperty(DarkButtonUI.KEY_THIN, Boolean.TRUE);

2
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkPanelPopupUI.java

@ -375,7 +375,7 @@ public class DarkPanelPopupUI extends DarkPanelUI implements PropertyChangeListe
this.ui = ui;
putClientProperty(DarkButtonUI.KEY_SQUARE, true);
putClientProperty(DarkButtonUI.KEY_ALT_ARC, Boolean.TRUE);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_SHADOW);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS);
setRolloverEnabled(true);
setMargin(UIManager.getInsets("TabFramePopup.headerButton.insets"));
setFocus(false);

2
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabbedPopupUI.java

@ -155,7 +155,7 @@ public class DarkTabbedPopupUI extends DarkPanelPopupUI {
@Override
protected JButton createButton() {
HeaderButton button = new HeaderButton(ui.getNewTabIcon(), DarkTabbedPopupUI.this);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_SHADOW);
button.putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS);
button.putClientProperty(DarkButtonUI.KEY_SQUARE, true);
button.putClientProperty(DarkButtonUI.KEY_THIN, Boolean.TRUE);
button.setRolloverEnabled(true);

2
core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/DarkToggleButtonUI.java

@ -140,7 +140,7 @@ public class DarkToggleButtonUI extends DarkButtonUI implements ToggleButtonCons
protected Color getBackgroundColor(final JComponent c) {
AbstractButton b = (AbstractButton) c;
boolean rollOver = (b.isRolloverEnabled() || ButtonConstants.doConvertToShadow(b))
boolean rollOver = (b.isRolloverEnabled() || ButtonConstants.doConvertToBorderless(b))
&& (((JButton) c).getModel().isRollover());
boolean clicked = b.getModel().isArmed();
boolean isSelected = c instanceof JToggleButton && ((JToggleButton) c).isSelected();

12
core/src/main/resources/com/github/weisj/darklaf/properties/overwrites.properties

@ -21,9 +21,9 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
SplitPane.defaultDividerStyle = spDividerStyle
Table.renderBooleanAsCheckBox = tableBooleanRenderer
Tree.renderBooleanAsCheckBox = treeBooleanRenderer
TextComponent.roundedSelection = roundedSelection
Button.convertIconOnlyToShadow = shadowIconButtons
Tree.defaultLineStyle = treeLineStyle
SplitPane.defaultDividerStyle = spDividerStyle
Table.renderBooleanAsCheckBox = tableBooleanRenderer
Tree.renderBooleanAsCheckBox = treeBooleanRenderer
TextComponent.roundedSelection = roundedSelection
Button.convertIconOnlyToBorderless = borderlessIconButtons
Tree.defaultLineStyle = treeLineStyle

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

@ -22,40 +22,40 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
ButtonUI = com.github.weisj.darklaf.ui.button.DarkButtonUI
Button.border = com.github.weisj.darklaf.ui.button.DarkButtonBorder
Button.disabledText = %textForegroundInactive
Button.shadow = %shadow
Button.selectedButtonForeground = %textForegroundDefault
Button.activeBorderColor = %widgetBorder
Button.inactiveBorderColor = %widgetBorderInactive
Button.defaultBorderColor = %widgetBorderDefault
Button.focusBorderColor = %glowFocusLine
Button.inactiveFillColor = %widgetFillInactive
Button.defaultFillColor = %widgetFillDefault
Button.defaultFillColorRollOver = %hoverHighlightDefault
Button.defaultFillColorClick = %clickHighlightDefault
Button.activeFillColor = %widgetFill
Button.activeFillColorRollOver = %hoverHighlight
Button.activeFillColorClick = %clickHighlight
ButtonUI = com.github.weisj.darklaf.ui.button.DarkButtonUI
Button.border = com.github.weisj.darklaf.ui.button.DarkButtonBorder
Button.disabledText = %textForegroundInactive
Button.shadow = %shadow
Button.selectedButtonForeground = %textForegroundDefault
Button.activeBorderColor = %widgetBorder
Button.inactiveBorderColor = %widgetBorderInactive
Button.defaultBorderColor = %widgetBorderDefault
Button.focusBorderColor = %glowFocusLine
Button.inactiveFillColor = %widgetFillInactive
Button.defaultFillColor = %widgetFillDefault
Button.defaultFillColorRollOver = %hoverHighlightDefault
Button.defaultFillColorClick = %clickHighlightDefault
Button.activeFillColor = %widgetFill
Button.activeFillColorRollOver = %hoverHighlight
Button.activeFillColorClick = %clickHighlight
Button.arc = %arc
Button.squareArc = %arcSecondary
Button.focusArc = %arcFocus
Button.squareFocusArc = %arcSecondaryFocus
Button.minimumArc = %arcSecondary
Button.borderThickness = %borderThickness
Button.shadowHeight = %shadowHeight
Button.arc = %arc
Button.squareArc = %arcSecondary
Button.focusArc = %arcFocus
Button.squareFocusArc = %arcSecondaryFocus
Button.minimumArc = %arcSecondary
Button.borderThickness = %borderThickness
Button.shadowHeight = %shadowHeight
Button.borderInsets = 7,16,7,16
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.fullShadowInsets = 0,0,0,0
Button.borderInsets = 7,16,7,16
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.shadow.hover = %hoverHighlight
Button.shadow.click = %clickHighlight
Button.borderless.hover = %hoverHighlight
Button.borderless.click = %clickHighlight
Button.defaultButtonFollowsFocus = false
Button.convertIconOnlyToShadow = true
Button.defaultButtonFollowsFocus = false
Button.convertIconOnlyToBorderless = true

6
core/src/test/java/UIDemo.java

@ -85,19 +85,19 @@ public final class UIDemo {
add(new JPanel(new FlowLayout(FlowLayout.LEFT)) {{
add(new JButton("IconButton", folderIcon) {{
setRolloverEnabled(true);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_SHADOW);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS);
}});
add(new JButton(folderIcon) {{
setRolloverEnabled(true);
putClientProperty(DarkButtonUI.KEY_SQUARE, true);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_SHADOW);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS);
}});
add(new JButton(folderIcon) {{
setRolloverEnabled(true);
putClientProperty(DarkButtonUI.KEY_SQUARE, true);
putClientProperty(DarkButtonUI.KEY_THIN, Boolean.TRUE);
putClientProperty(DarkButtonUI.KEY_ALT_ARC, Boolean.TRUE);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_SHADOW);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS);
}});
add(new JButton(folderIcon) {{
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_ONLY_LABEL);

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

@ -92,8 +92,8 @@ public class ButtonDemo implements ComponentDemo {
controlPanel.add(new JLabel(DarkButtonUI.KEY_VARIANT + ":"));
controlPanel.add(new JComboBox<String>() {{
addItem(DarkButtonUI.VARIANT_NONE);
addItem(DarkButtonUI.VARIANT_SHADOW);
addItem(DarkButtonUI.VARIANT_FULL_SHADOW);
addItem(DarkButtonUI.VARIANT_BORDERLESS);
addItem(DarkButtonUI.VARIANT_FULL_BORDERLESS);
addItem(DarkButtonUI.VARIANT_ONLY_LABEL);
setSelectedItem(DarkButtonUI.VARIANT_NONE);
addItemListener(e -> button.putClientProperty(DarkButtonUI.KEY_VARIANT, e.getItem()));

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

@ -144,16 +144,16 @@ public class WindowsTitlePane extends CustomTitlePane {
}
};
if (close) {
button.putClientProperty("JButton.shadow.hover",
button.putClientProperty("JButton.borderless.hover",
UIManager.getColor("Windows.TitlePane.close.rollOverColor"));
button.putClientProperty("JButton.shadow.click",
button.putClientProperty("JButton.borderless.click",
UIManager.getColor("Windows.TitlePane.close.clickColor"));
}
button.putClientProperty("JButton.noShadowOverwrite", true);
button.putClientProperty("JButton.noBorderlessOverwrite", true);
button.setFocusable(false);
button.setOpaque(true);
button.setRolloverEnabled(true);
button.putClientProperty("JButton.variant", "fullShadow");
button.putClientProperty("JButton.variant", "fullBorderless");
button.putClientProperty("paintActive", Boolean.TRUE);
button.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, accessibleName);
button.setAction(action);
@ -423,7 +423,9 @@ public class WindowsTitlePane extends CustomTitlePane {
private void createButtons() {
closeButton = createButton("Close", closeIcon, closeAction, true);
closeButton.setRolloverIcon(UIManager.getIcon("Windows.TitlePane.closeHover.icon"));
Icon closePressed = UIManager.getIcon("Windows.TitlePane.closeHover.icon");
closeButton.setRolloverIcon(closePressed);
closeButton.setPressedIcon(closePressed);
if (getWindowDecorationStyle() == JRootPane.FRAME) {
minimizeButton = createButton("Iconify", minimizeIcon, minimizeAction);

Loading…
Cancel
Save