diff --git a/platform/platform-api/src/com/intellij/ui/components/WideSelectionListUI.java b/platform/platform-api/src/com/intellij/ui/components/WideSelectionListUI.java index af9085d455a9..1a2aeae8a0ca 100644 --- a/platform/platform-api/src/com/intellij/ui/components/WideSelectionListUI.java +++ b/platform/platform-api/src/com/intellij/ui/components/WideSelectionListUI.java @@ -17,6 +17,8 @@ import javax.swing.*; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.basic.BasicListUI; import java.awt.*; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; import static com.intellij.openapi.util.SystemInfo.isMac; import static com.intellij.ui.paint.RectanglePainter.DRAW; @@ -223,6 +225,32 @@ public final class WideSelectionListUI extends BasicListUI { } } + @Override + protected FocusListener createFocusListener() { + var superFocusListener = super.createFocusListener(); + + // Support selected items background while changing focus + return new FocusListener() { + @Override + public void focusGained(FocusEvent e) { + if (list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) { + superFocusListener.focusGained(e); + } else { + list.repaint(); + } + } + + @Override + public void focusLost(FocusEvent e) { + if (list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) { + superFocusListener.focusLost(e); + } else { + list.repaint(); + } + } + }; + } + /** @noinspection MethodOverridesStaticMethodOfSuperclass, unused */ public static ComponentUI createUI(JComponent list) { return new WideSelectionListUI(); diff --git a/platform/platform-impl/internal/src/com/intellij/internal/ui/sandbox/components/ThreeStateCheckBoxPanel.kt b/platform/platform-impl/internal/src/com/intellij/internal/ui/sandbox/components/ThreeStateCheckBoxPanel.kt index 59130257b31c..0ecbc45f7227 100644 --- a/platform/platform-impl/internal/src/com/intellij/internal/ui/sandbox/components/ThreeStateCheckBoxPanel.kt +++ b/platform/platform-impl/internal/src/com/intellij/internal/ui/sandbox/components/ThreeStateCheckBoxPanel.kt @@ -10,7 +10,7 @@ import javax.swing.JComponent internal class ThreeStateCheckBoxPanel : UISandboxPanel { - override val title: String = "ThreeStateCheckBoxPanel" + override val title: String = "ThreeStateCheckBox" override fun createContent(disposable: Disposable): JComponent { return panel {