IDEA-224710: do not show lead selection for unfocused list or tree

GitOrigin-RevId: 5fa131ccb91e5c3827b4e8db09d88d866806d84a
This commit is contained in:
Sergey Malenkov
2020-01-30 18:31:30 +00:00
committed by intellij-monorepo-bot
parent 6b59be105b
commit e84885999b
2 changed files with 2 additions and 2 deletions
@@ -56,7 +56,7 @@ public final class WideSelectionListUI extends BasicListUI {
}
}
super.paintCell(g, row, rowBounds, renderer, model, selectionModel, leadSelectionIndex);
if (!selected && row == leadSelectionIndex && g instanceof Graphics2D) {
if (!selected && row == leadSelectionIndex && g instanceof Graphics2D && list.hasFocus()) {
g.setColor(UIUtil.getListSelectionBackground(true));
if (JList.VERTICAL == list.getLayoutOrientation()) {
int viewportX = 0;
@@ -238,7 +238,7 @@ public final class DefaultTreeUI extends BasicTreeUI {
rendererPane.paintComponent(g, component, tree, insets.left + offset, bounds.y, width, bounds.height, true);
}
}
if (!selected && lead && g instanceof Graphics2D) {
if (!selected && lead && focused && g instanceof Graphics2D) {
g.setColor(getBackground(tree, path, row, true));
DRAW.paint((Graphics2D)g, viewportX, bounds.y, viewportWidth, bounds.height, 0);
}