RFR: 8178368: Right alignment of text fields and alignment of prompt text works incorrectly [v5]

Karthik P K kpk at openjdk.org
Fri Feb 24 06:26:16 UTC 2023


On Thu, 23 Feb 2023 09:11:56 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> Karthik P K has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix text and prompt alignment issue
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TextFieldSkin.java line 831:
> 
>> 829:                     // Align to left when prompt text length is more than text field width
>> 830:                     promptNode.setLayoutX(caretWidth / 2);
>> 831:                 }
> 
> Similar comment, I don't think its correct. It's just odd that promptNewX  may be smaller than caretWidth / 2 but is accepted, but when the text is too wide the "minimum" value suddently is caretWidth / 2.
> 
> Also, I don't see how `promptOldX` has any relevance when it comes to positioning the prompt.  I think this is only relevant for the actual text (because it can scroll depending on where the cursor is), not for the prompt -- unless the prompt can be scrolled as well.  If that's the case then the `CENTER` case may need to be updated to take `promptOldX` into account as well.  As it stands currently, they have behaviors that seem to conflict.

Yes `promptOldX` is not required in case of prompt text. Code is updated.
Same comment as the first one for the condition while comparing newly calculated value with `careWidth/2`.

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

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


More information about the openjfx-dev mailing list