RFR: 8335547: Support multi-line prompt text for TextArea [v4]
Kevin Rushforth
kcr at openjdk.org
Fri Mar 28 21:43:14 UTC 2025
On Fri, 28 Mar 2025 18:20:59 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> That doesn't sound like a compelling reason to me. In fact, it makes it seems like a bug in JavaFX that a line break is only rendered with `\n`, but not with `\r\n` or `\r`.
>>
>> In any case, the goal here is to (semantically) transform a string such that it doesn't contain line breaks, and line breaks come in three different usual forms. Our goal should always be to do the right thing, and not stop half-way and rely on unspecified rendering quirks for the rest.
>
> Option 1 is intentionally the status quo, and matches what Swing's JComponent does, although @mstr2 is right that this isn't documented. An RFE to treat `\r` or `\r\n` as a newline could be considered in the future. We wouldn't do that as part of this PR.
>
> So for _this_ PR, the question is what characters should be elided for the prompt text of a `TextField` so that multiple lines as a single line? Limiting this to stripping `\n` is sufficient given the current implementation, unless and until something else changes. Also, it matches what the existing implementation tries to do when it modifies the actual property value.
One thing I am curious about: I don't see a similar stripping of newlines in the text itself for TextField, and yet it does render the whole string as if the newline had been stripped. Do you know why we need to strip it from promptTextProperty explicitly and not from textProperty?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1716#discussion_r2019299973
More information about the openjfx-dev
mailing list