Browse Source

Apply visual paddings directly after installation

pull/345/head
Jannis Weis 2 years ago
parent
commit
93167b5897
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 4
      core/src/main/java/com/github/weisj/darklaf/swingdsl/VisualPaddingListener.java
  2. 2
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  3. 2
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java
  4. 2
      core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerUI.java
  5. 2
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java
  6. 2
      core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/radiobutton/DarkRadioButtonUI.java

4
core/src/main/java/com/github/weisj/darklaf/swingdsl/VisualPaddingListener.java

@ -30,6 +30,10 @@ import com.github.weisj.darklaf.util.Types;
public class VisualPaddingListener implements PropertyChangeListener { public class VisualPaddingListener implements PropertyChangeListener {
public VisualPaddingListener(final JComponent c) {
VisualPaddingUtil.updateProperty(c);
}
@Override @Override
public void propertyChange(final PropertyChangeEvent evt) { public void propertyChange(final PropertyChangeEvent evt) {
if (PropertyKey.BORDER.equals(evt.getPropertyName())) { if (PropertyKey.BORDER.equals(evt.getPropertyName())) {

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

@ -152,7 +152,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
super.installListeners(b); super.installListeners(b);
keyboardActions = new ToggleButtonFocusNavigationActions(b); keyboardActions = new ToggleButtonFocusNavigationActions(b);
keyboardActions.installActions(); keyboardActions.installActions();
visualPaddingListener = new VisualPaddingListener(); visualPaddingListener = new VisualPaddingListener(b);
b.addPropertyChangeListener(visualPaddingListener); b.addPropertyChangeListener(visualPaddingListener);
} }

2
core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java

@ -112,7 +112,7 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
comboBoxListener = createComboBoxListener(); comboBoxListener = createComboBoxListener();
comboBox.addMouseListener(comboBoxListener); comboBox.addMouseListener(comboBoxListener);
comboBox.addPropertyChangeListener(comboBoxListener); comboBox.addPropertyChangeListener(comboBoxListener);
visualPaddingListener = new VisualPaddingListener(); visualPaddingListener = new VisualPaddingListener(comboBox);
comboBox.addPropertyChangeListener(visualPaddingListener); comboBox.addPropertyChangeListener(visualPaddingListener);
} }

2
core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerUI.java

@ -97,7 +97,7 @@ public class DarkSpinnerUI extends BasicSpinnerUI implements SpinnerConstants {
super.installListeners(); super.installListeners();
spinnerListener = createSpinnerListener(); spinnerListener = createSpinnerListener();
spinnerListener.install(); spinnerListener.install();
visualPaddingListener = new VisualPaddingListener(); visualPaddingListener = new VisualPaddingListener(spinner);
spinner.addPropertyChangeListener(visualPaddingListener); spinner.addPropertyChangeListener(visualPaddingListener);
} }

2
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java

@ -190,7 +190,7 @@ public abstract class DarkTextUI extends BasicTextUI implements OpacityBufferedU
textListener = createTextListener(); textListener = createTextListener();
editor.addFocusListener(textListener); editor.addFocusListener(textListener);
editor.addPropertyChangeListener(textListener); editor.addPropertyChangeListener(textListener);
visualPaddingListener = new VisualPaddingListener(); visualPaddingListener = new VisualPaddingListener(editor);
editor.addPropertyChangeListener(visualPaddingListener); editor.addPropertyChangeListener(visualPaddingListener);
} }

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

@ -96,7 +96,7 @@ public class DarkRadioButtonUI extends MetalRadioButtonUI implements PropertyCha
button.addPropertyChangeListener(this); button.addPropertyChangeListener(this);
keyboardAction = new ToggleButtonFocusNavigationActions(button); keyboardAction = new ToggleButtonFocusNavigationActions(button);
keyboardAction.installActions(); keyboardAction.installActions();
visualPaddingListener = new VisualPaddingListener(); visualPaddingListener = new VisualPaddingListener(button);
button.addPropertyChangeListener(visualPaddingListener); button.addPropertyChangeListener(visualPaddingListener);
} }

Loading…
Cancel
Save