From 4030295ce5d35b7eed4137f867e0cd3b989f97f5 Mon Sep 17 00:00:00 2001 From: Vladimir Sitnikov Date: Fri, 20 Mar 2020 15:14:57 +0300 Subject: [PATCH] combobox: editable combobox does not survive LaF change fixes #104 --- .../github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java | 1 - .../java/com/github/weisj/darklaf/ui/text/DarkTextUI.java | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java index 408b74a7..3143a0cb 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java @@ -160,7 +160,6 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements Border, PropertyC comboBox.repaint(); } }); - ((JComponent) comp).setBorder(null); return comboBoxEditor; } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java index 4acccb30..9198eef9 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java @@ -91,6 +91,12 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi @Override protected void installDefaults() { super.installDefaults(); + // OpenJDK BorderlessTextField has a bug with its setBorder implementation + // so we reset the border + // See https://mail.openjdk.java.net/pipermail/swing-dev/2020-March/010226.html + if (editor != null && "javax.swing.plaf.basic.BasicComboBoxEditor$BorderlessTextField".equals(editor.getClass().getName())) { + editor.setBorder(null); + } editor.putClientProperty(KEY_ROUNDED_SELECTION, UIManager.getBoolean("TextComponent.roundedSelection")); disabledColor = UIManager.getColor(getPropertyPrefix() + ".disabledBackground"); inactiveColor = UIManager.getColor(getPropertyPrefix() + ".inactiveBackground");