Browse Source

Remove unnecessary flag.

pull/198/head
weisj 4 years ago
parent
commit
2e3e443d9c
  1. 2
      core/src/main/java/com/github/weisj/darklaf/components/CloseButton.java
  2. 5
      core/src/main/java/com/github/weisj/darklaf/ui/button/ButtonConstants.java
  3. 1
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  4. 3
      core/src/main/java/com/github/weisj/darklaf/ui/splitpane/DarkSplitPaneDivider.java
  5. 6
      core/src/test/java/ui/button/AbstractButtonDemo.java
  6. 2
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

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

@ -31,13 +31,13 @@ import com.github.weisj.darklaf.ui.button.DarkButtonUI;
class CloseButton extends JButton {
protected CloseButton() {
putClientProperty(DarkButtonUI.KEY_NO_BACKGROUND, true);
putClientProperty(DarkButtonUI.KEY_NO_BORDERLESS_OVERWRITE, true);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS_RECTANGULAR);
putClientProperty(DarkButtonUI.KEY_THIN, true);
setOpaque(false);
setRolloverEnabled(true);
setBorderPainted(false);
setContentAreaFilled(false);
setIcon(UIManager.getIcon("CloseButton.closeIcon"));
setDisabledIcon(UIManager.getIcon("CloseButton.closeDisabledIcon"));
setRolloverIcon(UIManager.getIcon("CloseButton.closeHoverIcon"));

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

@ -42,7 +42,6 @@ public interface ButtonConstants {
String KEY_NO_BORDERLESS_OVERWRITE = "JButton.noBorderlessOverwrite";
String KEY_CORNER = "JButton.cornerFlag";
String KEY_ROUND = "JButton.round";
String KEY_NO_BACKGROUND = "JButton.noBackground";
String KEY_LEFT_NEIGHBOUR = "JButton.leftNeighbour";
String KEY_RIGHT_NEIGHBOUR = "JButton.rightNeighbour";
@ -129,8 +128,4 @@ public interface ButtonConstants {
static JComponent getNeighbour(final String key, final Component comp) {
return PropertyUtil.getObject(comp, key, JComponent.class);
}
static boolean isNoBackground(final AbstractButton b) {
return PropertyUtil.getBooleanProperty(b, KEY_NO_BACKGROUND);
}
}

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

@ -286,7 +286,6 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
}
protected boolean shouldDrawBackground(final AbstractButton c) {
if (ButtonConstants.isNoBackground(c)) return false;
Border border = c.getBorder();
return c.isEnabled() && border != null && button.isContentAreaFilled();
}

3
core/src/main/java/com/github/weisj/darklaf/ui/splitpane/DarkSplitPaneDivider.java

@ -31,7 +31,6 @@ import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicSplitPaneDivider;
import com.github.weisj.darklaf.icons.EmptyIcon;
import com.github.weisj.darklaf.ui.button.DarkButtonUI;
/**
* @author Jannis Weis
@ -122,7 +121,7 @@ public class DarkSplitPaneDivider extends BasicSplitPaneDivider {
protected OneTouchButton() {
setMinimumSize(new Dimension(ONE_TOUCH_SIZE, ONE_TOUCH_SIZE));
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
putClientProperty(DarkButtonUI.KEY_NO_BACKGROUND, true);
setContentAreaFilled(false);
setRequestFocusEnabled(false);
setBorderPainted(false);
setFocusPainted(false);

6
core/src/test/java/ui/button/AbstractButtonDemo.java

@ -100,10 +100,10 @@ public abstract class AbstractButtonDemo<T extends AbstractButton> implements Co
addActionListener(e -> button.putClientProperty(DarkButtonUI.KEY_ALT_ARC, isSelected()));
}
});
controlPanel.add(new JCheckBox(DarkButtonUI.KEY_NO_BACKGROUND) {
controlPanel.add(new JCheckBox("Content area filled") {
{
setSelected(false);
addActionListener(e -> button.putClientProperty(DarkButtonUI.KEY_NO_BACKGROUND, isSelected()));
setSelected(button.isContentAreaFilled());
addActionListener(e -> button.setContentAreaFilled(isSelected()));
}
});
controlPanel.add(new JCheckBox("Button.defaultButtonFollowsFocus") {

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

@ -389,12 +389,12 @@ public class WindowsTitlePane extends CustomTitlePane {
windowIconButton = new JButton();
windowIconButton.putClientProperty("JButton.noShadowOverwrite", true);
windowIconButton.setComponentPopupMenu(createMenu());
windowIconButton.putClientProperty("JButton.noBackground", true);
windowIconButton.addActionListener(e -> windowIconButton.getComponentPopupMenu()
.show(windowIconButton,
windowIconButton.getWidth() / 2,
windowIconButton.getHeight() / 2));
windowIconButton.setFocusable(false);
windowIconButton.setContentAreaFilled(false);
windowIconButton.setBorderPainted(false);
return windowIconButton;
}

Loading…
Cancel
Save