RFR: 8176270: Adding ChangeListener to TextField.selectedTextProperty causes StringOutOfBoundsException

Jeanette Winzenburg fastegal at openjdk.java.net
Wed May 27 10:20:58 UTC 2020


On Wed, 27 May 2020 07:50:00 GMT, Robert Lichtenberger <rlichten at openjdk.org> wrote:

>> Reopening the pull request, since PR #73 has been closed.
>
> Clearing the selection temporarily works fine to prevent the StringOutOfBoundsException but will also change
> selectionProperty to reflect the selection being 0/0 for a short time.

you are hacking around ;)

doSelect _must not_ be called somewhere "in-between" changing the text: the api doc clearly states that the
caret/anchor coordinates are the _new_ coordinates, that is after all changes have been applied. When re-calculating
them on-the-fly might have unexpected side-effects, f.i. if a TextFormatter had something special in mind (no failing
test handy though).

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

PR: https://git.openjdk.java.net/jfx/pull/138


More information about the openjfx-dev mailing list