RFR: 8301121: RichTextArea Control (Incubator) [v19]
Kevin Rushforth
kcr at openjdk.org
Fri Oct 4 18:52:44 UTC 2024
On Fri, 4 Oct 2024 18:23:41 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
> As a consequence of this, the following example from the `RichTextArea` class docs (also found in the JEP) using a `SimpleViewOnlyStyledModel` with inline CSS styles is no longer possible:
>
> ```
> SimpleViewOnlyStyledModel m = new SimpleViewOnlyStyledModel();
> // add text segment using CSS style name (requires a style sheet)
> m.addSegment("RichTextArea ", null, "HEADER");
> // add text segment using direct style
> m.addSegment("Demo", "-fx-font-size:200%;", null);
> // newline
> m.nl();
>
> RichTextArea textArea = new RichTextArea(m);
> ```
>
> You will either need additional methods in `SimpleViewOnlyStyledModel` to restore this functionality or rework the demo in the RTA docs (and JEP) to not use CSS. I recommend the former unless there is a good reason you can't.
Oh _now_ I see what you did. You renamed them a while back, and I missed that. The following works, but I think the old names (or something similar) might be clearer. Is there a reason for the change? I don't remember seeing any discussion on it, nor did the code snippets in the RTA class docs and JEP get updated:
SimpleViewOnlyStyledModel m = new SimpleViewOnlyStyledModel();
// add text segment using CSS style name (requires a style sheet)
m.withInlineAndExternalStyles("RichTextArea ", null, "HEADER");
// add text segment using direct style
m.withInlineStyle("Demo", "-fx-font-size:200%;");
// newline
m.nl();
RichTextArea textArea = new RichTextArea(m);
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1524#issuecomment-2394370006
More information about the openjfx-dev
mailing list