Browse Source

Fix issue where tables aren't editable. (Fixes #206).

Fix incorrect cell editor background color.
pull/214/head
weisj 4 years ago
parent
commit
7fb16e67e7
  1. 2
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java
  2. 4
      core/src/main/java/com/github/weisj/darklaf/ui/table/renderer/DarkTableCellEditorDelegate.java

2
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java

@ -574,7 +574,7 @@ public class DarkTableUI extends DarkTableUIBridge implements TableConstants {
} }
} }
Component comp = table.getEditorComponent(); Component comp = table.getEditorComponent();
if (comp != null) { if (comp != null && !(e.getOppositeComponent() == comp || DarkUIUtil.hasFocus(comp))) {
Color newBg = CellUtil.getTableBackground(comp, table, true, false, table.getEditingRow()); Color newBg = CellUtil.getTableBackground(comp, table, true, false, table.getEditingRow());
CellUtil.setupBackground(comp, newBg); CellUtil.setupBackground(comp, newBg);
} }

4
core/src/main/java/com/github/weisj/darklaf/ui/table/renderer/DarkTableCellEditorDelegate.java

@ -74,8 +74,8 @@ public class DarkTableCellEditorDelegate extends TableCellEditorDelegate {
if (DarkTableUI.ignoreKeyCodeOnEdit((KeyEvent) anEvent, table)) return false; if (DarkTableUI.ignoreKeyCodeOnEdit((KeyEvent) anEvent, table)) return false;
} }
if (TableConstants.isBooleanRenderingEnabled(table)) { if (TableConstants.isBooleanRenderingEnabled(table)) {
if (anEvent instanceof MouseEvent) { if (anEvent instanceof MouseEvent && isMouseOverBooleanRenderer((MouseEvent) anEvent, table)) {
return isMouseOverBooleanRenderer((MouseEvent) anEvent, table); return true;
} }
} }
return super.isCellEditable(anEvent); return super.isCellEditable(anEvent);

Loading…
Cancel
Save