Skip to content

Commit

Permalink
fix(gui): improve focus handling in AutoDevVariableList #51
Browse files Browse the repository at this point in the history
The commit addresses an issue where the focus handling in the AutoDevVariableList component was not properly managed, leading to inconsistent visual feedback for selected cells. The fix ensures that the selected cells are highlighted with the appropriate border, regardless of the focus state, by conditionally setting the border based on the cell's focus and selection status.
  • Loading branch information
phodal committed Mar 8, 2024
1 parent 6f6bdb1 commit f774c6d
Showing 1 changed file with 5 additions and 9 deletions.
Expand Up @@ -50,20 +50,16 @@ class VariableListCellRenderer : ListCellRenderer<AutoDevVariableListItemCompone
value.foreground = if (isSelected) jList.selectionForeground else jList.foreground
value.isEnabled = jList.isEnabled
value.font = jList.font

var border: Border? = null
if (cellHasFocus) {
value.border = if (cellHasFocus) {
if (isSelected) {
border = UIManager.getBorder("List.focusSelectedCellHighlightBorder")
}
if (border == null) {
border = UIManager.getBorder("List.focusCellHighlightBorder")
UIManager.getBorder("List.focusSelectedCellHighlightBorder")
} else {
UIManager.getBorder("List.focusCellHighlightBorder")
}
} else {
border = this.emptyBorder
emptyBorder
}

value.border = border
return value
}
}
Expand Down

0 comments on commit f774c6d

Please sign in to comment.