From 53f273006412af97173b0f302996878fbc8399e1 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Thu, 17 Mar 2022 12:21:06 +0100 Subject: [PATCH] TextArea, TextPane and EditorPane: no longer select all text when component is focused for the first time (issue #498; regression in FlatLaf 2.0) --- CHANGELOG.md | 2 ++ .../src/main/java/com/formdev/flatlaf/ui/FlatCaret.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 101e4f65..ef566328 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ FlatLaf Change Log - PasswordField: Fixed reveal button appearance in IntelliJ themes. (issue #494) - ScrollBar: Center and scale arrows in scroll up/down buttons (if shown). (issue #493) +- TextArea, TextPane and EditorPane: No longer select all text when component is + focused for the first time. (issue #498; regression in FlatLaf 2.0) #### Incompatibilities diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatCaret.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatCaret.java index b2ffa2cd..95c0ccc1 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatCaret.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatCaret.java @@ -236,7 +236,7 @@ public class FlatCaret if( selectAllOnFocusPolicy == null ) selectAllOnFocusPolicy = this.selectAllOnFocusPolicy; - if( SELECT_ALL_ON_FOCUS_POLICY_NEVER.equals( selectAllOnFocusPolicy ) ) + if( selectAllOnFocusPolicy == null || SELECT_ALL_ON_FOCUS_POLICY_NEVER.equals( selectAllOnFocusPolicy ) ) return; if( !SELECT_ALL_ON_FOCUS_POLICY_ALWAYS.equals( selectAllOnFocusPolicy ) ) {