Browse Source

Simplified lead selection check.

pull/97/head
weisj 5 years ago
parent
commit
70f0a4031a
  1. 7
      core/src/main/java/com/github/weisj/darklaf/ui/cell/DarkCellRendererToggleButton.java
  2. 7
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableCellRenderer.java

7
core/src/main/java/com/github/weisj/darklaf/ui/cell/DarkCellRendererToggleButton.java

@ -61,10 +61,9 @@ public class DarkCellRendererToggleButton<T extends JToggleButton & CellEditorTo
toggleButton.setHorizontalAlignment(table.getComponentOrientation().isLeftToRight() ? LEFT : RIGHT); toggleButton.setHorizontalAlignment(table.getComponentOrientation().isLeftToRight() ? LEFT : RIGHT);
toggleButton.setHasFocus(focus); toggleButton.setHasFocus(focus);
boolean isLeadSelectionCell = DarkUIUtil.hasFocus(table) boolean isLeadSelectionCell = DarkUIUtil.hasFocus(table) && (focus
&& table.getSelectionModel().getLeadSelectionIndex() == row || (table.getSelectionModel().getLeadSelectionIndex() == row
&& (table.getColumnModel().getSelectionModel().getLeadSelectionIndex() == column && DarkTableCellFocusBorder.isRowFocusBorder(table)));
|| DarkTableCellFocusBorder.isRowFocusBorder(table));
boolean alternativeRow = Boolean.TRUE.equals(table.getClientProperty(DarkTableUI.KEY_ALTERNATE_ROW_COLOR)); boolean alternativeRow = Boolean.TRUE.equals(table.getClientProperty(DarkTableUI.KEY_ALTERNATE_ROW_COLOR));
Color alternativeRowColor = UIManager.getColor("Table.alternateRowBackground"); Color alternativeRowColor = UIManager.getColor("Table.alternateRowBackground");

7
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableCellRenderer.java

@ -63,10 +63,9 @@ public class DarkTableCellRenderer extends DefaultTableCellRenderer {
this.setVerticalAlignment(SwingConstants.CENTER); this.setVerticalAlignment(SwingConstants.CENTER);
setHorizontalAlignment(table.getComponentOrientation().isLeftToRight() ? LEFT : RIGHT); setHorizontalAlignment(table.getComponentOrientation().isLeftToRight() ? LEFT : RIGHT);
boolean isLeadSelectionCell = DarkUIUtil.hasFocus(table) boolean isLeadSelectionCell = DarkUIUtil.hasFocus(table) && (hasFocus
&& table.getSelectionModel().getLeadSelectionIndex() == row || (table.getSelectionModel().getLeadSelectionIndex() == row
&& (table.getColumnModel().getSelectionModel().getLeadSelectionIndex() == column && DarkTableCellFocusBorder.isRowFocusBorder(table)));
|| DarkTableCellFocusBorder.isRowFocusBorder(table));
if (DarkTableCellFocusBorder.isRowFocusBorder(table) if (DarkTableCellFocusBorder.isRowFocusBorder(table)
&& table.getSelectionModel().getLeadSelectionIndex() == row && table.getSelectionModel().getLeadSelectionIndex() == row

Loading…
Cancel
Save