Browse Source

Ensure text components have the correct background after the laf changes.

pull/222/head
weisj 4 years ago
parent
commit
1cb88d8b7f
  1. 2
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextListener.java
  2. 5
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java

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

@ -89,7 +89,7 @@ public class DarkTextListener implements FocusListener, PropertyChangeListener {
} else if ("border".equals(key)) { } else if ("border".equals(key)) {
ui.installBorder(); ui.installBorder();
} else if (PropertyKey.ENABLED.equals(key) || PropertyKey.EDITABLE.equals(key)) { } else if (PropertyKey.ENABLED.equals(key) || PropertyKey.EDITABLE.equals(key)) {
PropertyUtil.installBackground(editor, ui.getBackground(editor)); ui.updateBackground(editor);
} }
} }
} }

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

@ -117,6 +117,7 @@ public abstract class DarkTextUI extends BasicTextUI implements OpacityBufferedU
updateMargins(); updateMargins();
installBorder(); installBorder();
installPopupMenu(); installPopupMenu();
updateBackground(editor);
} }
@ -203,6 +204,10 @@ public abstract class DarkTextUI extends BasicTextUI implements OpacityBufferedU
visualPaddingListener = null; visualPaddingListener = null;
} }
protected void updateBackground(final JTextComponent c) {
PropertyUtil.installBackground(c, getBackground(c));
}
protected Color getBackground(final JTextComponent c) { protected Color getBackground(final JTextComponent c) {
if (!c.isEnabled()) { if (!c.isEnabled()) {
return disabledColor; return disabledColor;

Loading…
Cancel
Save