List, Table and Tree: item selection color of focused components no longer change from blue to gray when temporary loosing focus (e.g. showing a popup menu)

This commit is contained in:
Karl Tauber
2020-04-17 19:14:48 +02:00
parent 97a1bf90a4
commit 2e1acb7871
6 changed files with 68 additions and 4 deletions

View File

@@ -106,7 +106,7 @@ public class FlatListUI
@Override
public void focusLost( FocusEvent e ) {
super.focusLost( e );
toggleSelectionColors( false );
toggleSelectionColors( e.isTemporary() );
}
};
}

View File

@@ -166,7 +166,7 @@ public class FlatTableUI
@Override
public void focusLost( FocusEvent e ) {
super.focusLost( e );
toggleSelectionColors( false );
toggleSelectionColors( e.isTemporary() );
}
};
}

View File

@@ -20,6 +20,7 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.KeyboardFocusManager;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
@@ -221,7 +222,7 @@ public class FlatTreeUI
TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf )
{
boolean isEditing = (editingComponent != null && editingRow == row);
boolean hasFocus = tree.hasFocus();
boolean hasFocus = (KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner() == tree);
boolean cellHasFocus = hasFocus && (row == getLeadSelectionRow());
boolean isSelected = tree.isRowSelected( row );
boolean isDropRow = isDropRow( row );