RFR: 8178368: Right alignment of text fields works incorrectly

Andy Goryachev angorya at openjdk.org
Thu Dec 22 19:02:58 UTC 2022


On Wed, 21 Dec 2022 10:58:50 GMT, Karthik P K <kpk at openjdk.org> wrote:

> When Text width was more than TextField width, condition to update `textTranslateX` was not getting satisfied as calculated value was negative. Hence the text was getting aligned to previous `textTranslateX` value.
> 
> Added else block to update the `textTranslateX` value when calculated value is negative.
> 
> Added unit test to validate the fix.

I think it's a good opportunity to test and fix all other `Pos.values()`

Actually, it looks like this use case of setting a long text on TextField with alignment *other than* LEFT is broken.  Here is it for TOP_CENTER which also is incorrect:

<img width="1112" alt="Screen Shot 2022-12-22 at 10 55 11" src="https://user-images.githubusercontent.com/107069028/209206893-f792abaa-ba2c-4802-89fa-fd2640488b8c.png">

I might recommend using the tester to enumerate all the cases where the initial text position is incorrect and fix it as a part of this ticket.  We could also modify the test to cycle through all the possible values of `Pos.values()`.

What do you think?

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

Changes requested by angorya (Committer).

PR: https://git.openjdk.org/jfx/pull/980


More information about the openjfx-dev mailing list