RFR: 8322748: Caret blinking in JavaFX should only stop when caret moves

Andy Goryachev angorya at openjdk.org
Thu Feb 15 16:56:58 UTC 2024


On Thu, 15 Feb 2024 14:04:30 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> Move caret animation handling due to keyboard input to the Skin, by registering a listener on the caretPosition property.  This will restart animation only when the caret position changes instead of every key press.
>> 
>> This also simplifies internal behaviors of TextArea, TextField, and PasswordField in light of the future InputMap RFE [JDK-8314968](https://bugs.openjdk.org/browse/JDK-8314968)
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TextAreaSkin.java line 183:
> 
>> 181:                 setForwardBias(true);
>> 182:             }
>> 183:             setCaretAnimating(true);
> 
> I find this a bit confusing.  By putting the two `setCaretAnimating` separate, you give the impression it must stop blinking for a while before continuing because of the call to `setForwardBias`.
> 
> However, all we want to is call it with `false` then `true` to restart the animation (for a lack of a `playFromStart` call).  Perhaps it may be good to introduce a method that captures this more clearly as I find it confusing (`restartCaretAnimation`)
> 
> Same comment for `TextFieldSkin`.

good point

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1368#discussion_r1491332357


More information about the openjfx-dev mailing list