mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-197361 Multi-selection is not repainted while focus changing
GitOrigin-RevId: 2f2ec413f1e34644a5c43d86b0309d670f2adf1b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
138020a17f
commit
b4967bd2ed
@@ -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();
|
||||
|
||||
+1
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user