Skip to content

Commit

Permalink
Table: do not select text in cell editor when it gets focus (when `JT…
Browse files Browse the repository at this point in the history
…able.surrendersFocusOnKeystroke` is `true`) and `TextComponent.selectAllOnFocusPolicy` is `once` (the default) or `always` (issue #395)

(cherry picked from commit f8b9f4c)
  • Loading branch information
DevCharly committed Nov 11, 2021
1 parent a253b6c commit 150bab0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void mouseReleased( MouseEvent e ) {
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 );
Expand Down

0 comments on commit 150bab0

Please sign in to comment.