Browse Source

Fixed file chooser updating when using arrow keys to navigate in directory/filter combobox.

Made buttons non-rollover by default.
pull/130/head
weisj 5 years ago
parent
commit
517d154ab5
  1. 3
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  2. 4
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUI.java
  3. 6
      core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/DarkToggleButtonUI.java
  4. 1
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/button.properties

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

@ -338,8 +338,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.doConvertToBorderless(b))
&& (((JButton) c).getModel().isRollover());
boolean rollOver = b.isRolloverEnabled() && b.getModel().isRollover();
boolean clicked = b.getModel().isArmed();
if (c.isEnabled()) {
if (defaultButton) {

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

@ -189,6 +189,7 @@ public class DarkFileChooserUI extends DarkFileChooserUIBridge {
comboBox.setEnabled(comboBox.getItemCount() > 1);
}
});
comboBox.putClientProperty("JComboBox.isTableCellEditor", true);
comboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, filesOfTypeLabelText);
comboBox.setRenderer(createFilterComboBoxRenderer());
return comboBox;
@ -219,6 +220,7 @@ public class DarkFileChooserUI extends DarkFileChooserUIBridge {
return d;
}
};
comboBox.putClientProperty("JComboBox.isTableCellEditor", true);
comboBox.putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, lookInLabelText);
comboBox.addActionListener(directoryComboBoxAction);
comboBox.setRenderer(createDirectoryComboBoxRenderer(fileChooser));
@ -318,7 +320,7 @@ public class DarkFileChooserUI extends DarkFileChooserUIBridge {
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);
button.putClientProperty(DarkButtonUI.KEY_SQUARE, true);
button.setAlignmentX(JComponent.LEFT_ALIGNMENT);
button.setAlignmentY(JComponent.CENTER_ALIGNMENT);
button.setToolTipText(tipText);

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

@ -23,7 +23,6 @@
*/
package com.github.weisj.darklaf.ui.togglebutton;
import com.github.weisj.darklaf.ui.button.ButtonConstants;
import com.github.weisj.darklaf.ui.button.DarkButtonUI;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.GraphicsContext;
@ -140,10 +139,9 @@ public class DarkToggleButtonUI extends DarkButtonUI implements ToggleButtonCons
protected Color getBackgroundColor(final JComponent c) {
AbstractButton b = (AbstractButton) c;
boolean rollOver = (b.isRolloverEnabled() || ButtonConstants.doConvertToBorderless(b))
&& (((JButton) c).getModel().isRollover());
boolean rollOver = b.isRolloverEnabled() && b.getModel().isRollover();
boolean clicked = b.getModel().isArmed();
boolean isSelected = c instanceof JToggleButton && ((JToggleButton) c).isSelected();
boolean isSelected = b.isSelected();
if (c.isEnabled()) {
if (isSelected) return background;
if (clicked) {

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

@ -60,5 +60,6 @@ Button.borderless.outline.hover = %hoverHighlightOutline
Button.borderless.outline.click = %clickHighlightOutline
Button.borderless.drawOutline = false
Button.rollover = false
Button.defaultButtonFollowsFocus = false
Button.convertIconOnlyToBorderless = true

Loading…
Cancel
Save