RFR: 8178368: Right alignment of text fields works incorrectly

Karthik P K kpk at openjdk.org
Thu Dec 22 06:49:53 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.

Thanks for the above details Andy.
I saw this behavior with the source code given in the bug as well.

> When the prompt text length exceeds the width of the text field, it looks like the prompt text is right-aligned, and the end of the prompt text is visible (the prompt text is "":
> 
I believe in this case, it gets aligned to the right because text width is less than text field width.
 
> However, setting a long text results in the beginning of the said text showing (the text string is `"<beg-01234567890123456789012345678901234567890123456789012345678901234567890123456789-end>"`):
> 
Yes setting a long text is resulting in this behavior. I fixed the bug based on this behavior itself.

>So the question is - do we want to change the way text is initially aligned to match the prompt text, or not?
>
Yes this have to be discussed if we want to change the initial behavior of the text alignment.

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

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


More information about the openjfx-dev mailing list