Table: do not select text in cell editor when it gets focus (when JTable.surrendersFocusOnKeystroke is true) and TextComponent.selectAllOnFocusPolicy is once (the default) or always (issue #395)

(cherry picked from commit f8b9f4c1fa)
This commit is contained in:
Karl Tauber
2021-11-11 12:19:58 +01:00
parent a253b6c0cf
commit 150bab0b57
2 changed files with 11 additions and 1 deletions

View File

@@ -1,6 +1,16 @@
FlatLaf Change Log
==================
## 1.6.2
#### Fixed bugs
- Table: Do not select text in cell editor when it gets focus (when
`JTable.surrendersFocusOnKeystroke` is `true`) and
`TextComponent.selectAllOnFocusPolicy` is `once` (the default) or `always`.
(issue #395)
## 1.6.1
#### Fixed bugs

View File

@@ -108,7 +108,7 @@ public class FlatCaret
protected void selectAllOnFocusGained() {
JTextComponent c = getComponent();
Document doc = c.getDocument();
if( doc == null || !c.isEnabled() || !c.isEditable() )
if( doc == null || !c.isEnabled() || !c.isEditable() || FlatUIUtils.isCellEditor( c ) )
return;
Object selectAllOnFocusPolicy = c.getClientProperty( SELECT_ALL_ON_FOCUS_POLICY );