RFR: 8178368: Right alignment of text fields works incorrectly

Ajit Ghaisas aghaisas at openjdk.org
Thu Dec 22 10:36:01 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.

The proposed fix fixes the reported issue.

**Regarding the question of changing current behavior of RIGHT alignment of the TextField:**
If the string is larger than the TextField width -
- LEFT align should result in - Start of the text visible and end of the text hidden.
- RIGHT align should result in - End of the text visible at the right edge of the TextField and start of the text hidden.

Right now, only the LEFT align behaves correctly.
RIGHT align behaves correctly only if the string is smaller than the TextField width. The moment string length is larger than TextField width, it starts behaving opposite (start of the text visible and end of the text hidden.)
I don't know whether there is some rationale for this implementation or it is a bug which went unnoticed till now.

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

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


More information about the openjfx-dev mailing list