From 7fb16e67e7e1fbadae55e5907e339bedce473f0f Mon Sep 17 00:00:00 2001 From: weisj Date: Fri, 11 Sep 2020 22:10:14 +0200 Subject: [PATCH] Fix issue where tables aren't editable. (Fixes #206). Fix incorrect cell editor background color. --- .../java/com/github/weisj/darklaf/ui/table/DarkTableUI.java | 2 +- .../ui/table/renderer/DarkTableCellEditorDelegate.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java index 1b287b5e..b65b0c2f 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java +++ b/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(); - if (comp != null) { + if (comp != null && !(e.getOppositeComponent() == comp || DarkUIUtil.hasFocus(comp))) { Color newBg = CellUtil.getTableBackground(comp, table, true, false, table.getEditingRow()); CellUtil.setupBackground(comp, newBg); } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/table/renderer/DarkTableCellEditorDelegate.java b/core/src/main/java/com/github/weisj/darklaf/ui/table/renderer/DarkTableCellEditorDelegate.java index 6e5ca302..297e14d7 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/table/renderer/DarkTableCellEditorDelegate.java +++ b/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 (TableConstants.isBooleanRenderingEnabled(table)) { - if (anEvent instanceof MouseEvent) { - return isMouseOverBooleanRenderer((MouseEvent) anEvent, table); + if (anEvent instanceof MouseEvent && isMouseOverBooleanRenderer((MouseEvent) anEvent, table)) { + return true; } } return super.isCellEditable(anEvent);