<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Andy, thank you for such a detailed reply.<br>
<br>
Unfortunately, I believe this direction is misguided and should be
avoided. That’s why I’ve added further information to JDK-8356436.<br>
<br>
Best regards, Pavel<br>
<br>
<div class="moz-cite-prefix">On 5/7/25 22:14, Andy Goryachev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:BYAPR10MB301389C6BCDB11A7A5E6A4D8E588A@BYAPR10MB3013.namprd10.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator"
content="Microsoft Word 15 (filtered medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:"Yu Gothic";
panose-1:2 11 4 0 0 0 0 0 0 0;}@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}@font-face
{font-family:"Iosevka Fixed SS16";
panose-1:2 0 5 9 3 0 0 0 0 4;}@font-face
{font-family:"Times New Roman \(Body CS\)";
panose-1:2 11 6 4 2 2 2 2 2 4;}@font-face
{font-family:"\@Yu Gothic";
panose-1:2 11 4 0 0 0 0 0 0 0;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Aptos",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}span.EmailStyle200
{mso-style-type:personal-reply;
font-family:"Iosevka Fixed SS16";
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}div.WordSection1
{page:WordSection1;}</style>
<div class="WordSection1">
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">>
</span><span style="font-size:12.0pt">Could you please confirm
whether RichParagraph.Builder.addWithStyleNames(String text,
String... css) can also be used for background coloring?</span><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">No,
it cannot. This (and other methods that add a text
segment), while adding the style names to the underlying
nodes, cannot style the background. The reason is these
methods add the Text instances, and the Text class does not
have the background property. So even if your CSS style
specifies the background properties, they will be ignored.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">The
highlights, on the other hand, are special shapes placed
behind the text nodes, and these can be styled with
background (though the corresponding public APIs are
missing, JDK-8355774). Same applies to wavy lines.<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">I'll
try to clarify these points in
<a href="https://bugs.openjdk.org/browse/JDK-8355774"
moz-do-not-send="true" class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8355774</a><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy<o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span
style="font-size:12.0pt;color:black">openjfx-dev
<a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev-retn@openjdk.org"><openjfx-dev-retn@openjdk.org></a> on behalf of
PavelTurk <a class="moz-txt-link-rfc2396E" href="mailto:pavelturk2000@gmail.com"><pavelturk2000@gmail.com></a><br>
<b>Date: </b>Wednesday, May 7, 2025 at 11:54<br>
<b>To: </b><a class="moz-txt-link-abbreviated" href="mailto:openjfx-dev@openjdk.org">openjfx-dev@openjdk.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev@openjdk.org"><openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Re: CodeArea: -fx-background-color
doesn't work.<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span
style="font-size:12.0pt">I've read your comments on
the issue and was actually in the process of writing
to you when I received your message.
<br>
Let me clarify a critically important point.<br>
<br>
Currently, to style segment text using CSS style
classes, we use this method:<br>
RichParagraph.Builder.addWithStyleNames(String text,
String... css) - ONE METHOD FOR ALL STYLE CLASSES.<br>
<br>
If I understand correctly (and I might be wrong!),
you're suggesting using a DIFFERENT method for
background color styling:<br>
RichParagraph.Builder#addHighlight(int start, int end,
String... styles).<br>
<br>
Could you please confirm whether
RichParagraph.Builder.addWithStyleNames(String text,
String... css) can also be used for background
coloring?<br>
<br>
For example, we know that user wants to add style
classes "foo" and "bar" to a text from from 5 to 20.
We do not know IF THESE STYLES
<br>
SET BACKGROUND COLOR. Or should we ask an user to name
a class this way - "foo-bg"?
<br>
<br>
Best regards, Pavel<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt">On
5/7/25 21:16, Andy Goryachev wrote:<o:p></o:p></span></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Thank
<i>you</i> for the feedback!</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">I
finally got the ticket -
<a
href="https://bugs.openjdk.org/browse/JDK-8356436"
moz-do-not-send="true"
class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8356436</a>
. It's a dup of
<a
href="https://bugs.openjdk.org/browse/JDK-8355774"
moz-do-not-send="true"
class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8355774</a>
, essentially. Once the missing APIs are added,
you'll be able to style the highlights with CSS:</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">RichParagraph.Builder#addHighlight(int
start, int length, String ... css)
</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">P.S.
In some of your code, you do css.toArray() for
each paragraph. I wonder if you should just
create a bunch of styles statically instead - like
a document stylesheet, since these names do not
change at all.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"
style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span
style="font-size:12.0pt;color:black">openjfx-dev
<a
href="mailto:openjfx-dev-retn@openjdk.org" moz-do-not-send="true">
<openjfx-dev-retn@openjdk.org></a>
on behalf of PavelTurk <a
href="mailto:pavelturk2000@gmail.com"
moz-do-not-send="true">
<pavelturk2000@gmail.com></a><br>
<b>Date: </b>Wednesday, May 7, 2025 at
10:30<br>
<b>To: </b><a
href="mailto:openjfx-dev@openjdk.org"
moz-do-not-send="true"
class="moz-txt-link-freetext">openjfx-dev@openjdk.org</a>
<a href="mailto:openjfx-dev@openjdk.org"
moz-do-not-send="true">
<openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Re: CodeArea:
-fx-background-color doesn't work.</span><o:p></o:p></p>
</div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"><span
style="font-size:12.0pt">Andy, thank you
very much for your help!<br>
<br>
Best regards, Pavel</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt">On 5/7/25 20:29,
Andy Goryachev wrote:</span><o:p></o:p></p>
</div>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">This
bug is still percolating through the
system. I'll respond once I get it.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Thank
you for all the questions and the
feedback!</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<div
id="mail-editor-reference-message-container">
<div>
<div>
<div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"
style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span
style="font-size:12.0pt;color:black">openjfx-dev <a
href="mailto:openjfx-dev-retn@openjdk.org" moz-do-not-send="true">
<openjfx-dev-retn@openjdk.org></a> on behalf of PavelTurk <a
href="mailto:pavelturk2000@gmail.com" moz-do-not-send="true">
<pavelturk2000@gmail.com></a><br>
<b>Date: </b>Monday, May 5,
2025 at 14:13<br>
<b>To: </b><a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true"
class="moz-txt-link-freetext">openjfx-dev@openjdk.org</a>
<a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true">
<openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Re: CodeArea:
-fx-background-color doesn't
work.</span><o:p></o:p></p>
</div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"><span
style="font-size:12.0pt">No, I am
afraid you misunderstood me. I am
not talking about compatibility
with a third party library.<br>
The "compatibility" already exists
and its name is CSS. So, the only
thing I need is to support
<br>
'-fx-background-color' for
RichParagraph segment.<br>
<br>
I've opened an issue today, so,
when it is approved there won't be
any questions.<br>
<br>
Best regards, Pavel</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt">On
5/6/25 00:04, Andy Goryachev
wrote:</span><o:p></o:p></p>
</div>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Will
not happen. CSS compatibility
with a third party library is
not a requirement in this
case.</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<div
id="mail-editor-reference-message-container">
<div>
<div>
<div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"
style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span
style="font-size:12.0pt;color:black">openjfx-dev <a
href="mailto:openjfx-dev-retn@openjdk.org" moz-do-not-send="true">
<openjfx-dev-retn@openjdk.org></a> on behalf of PavelTurk <a
href="mailto:pavelturk2000@gmail.com" moz-do-not-send="true">
<pavelturk2000@gmail.com></a><br>
<b>Date: </b>Monday,
May 5, 2025 at 13:59<br>
<b>To: </b><a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true"
class="moz-txt-link-freetext">openjfx-dev@openjdk.org</a> <a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true">
<openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Re:
CodeArea:
-fx-background-color
doesn't work.</span><o:p></o:p></p>
</div>
<p class="MsoNormal"
style="margin-bottom:12.0pt"><span style="font-size:12.0pt">To be as
clear as possible,
here's what I need:<br>
<br>
.test {<br>
-fx-set-somehow-background-color:
green;<br>
}<br>
<br>
var builder =
RichParagraph.builder();<br>
builder.addWithStyleNames(segment, "test");<br>
<br>
because, in parallel for
RTFX I simply use its
stylesheet:<br>
<br>
.test {<br>
-rtfx-background-color:
green;<br>
}<br>
<br>
<br>
So, for both code areas,
I use same style classes
for styling paragraph
segments.<br>
<br>
Best regards, Pavel</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt">On 5/5/25 23:20, Andy Goryachev wrote:</span><o:p></o:p></p>
</div>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Right,
the API are missing
currently. I just
point out the fact
that you must use
highlights for the
purpose of
highlighting text
range(s) within the
paragraph, since
these ranges might
contain
semi-transparent
Nodes. Once
JDK-8355774 is fixed
you'll be able to
style highlights
with CSS and all
will be well.
Right?</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy</span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<div
id="mail-editor-reference-message-container">
<div>
<div>
<div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p
class="MsoNormal" style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span
style="font-size:12.0pt;color:black">openjfx-dev <a
href="mailto:openjfx-dev-retn@openjdk.org" moz-do-not-send="true">
<openjfx-dev-retn@openjdk.org></a> on behalf of PavelTurk <a
href="mailto:pavelturk2000@gmail.com" moz-do-not-send="true">
<pavelturk2000@gmail.com></a><br>
<b>Date: </b>Monday,
May 5, 2025 at
13:10<br>
<b>To: </b><a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true"
class="moz-txt-link-freetext">openjfx-dev@openjdk.org</a> <a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true">
<openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Re:
CodeArea:
-fx-background-color
doesn't work.</span><o:p></o:p></p>
</div>
<p
class="MsoNormal" style="margin-bottom:12.0pt"><span
style="font-size:12.0pt">Andy, thank you very much for your help.
<br>
<br>
That doesn’t
work for me.
As I mentioned
before, I’m
working with
two CodeArea
implementations
- JFX and
RTFX,
<br>
and CSS is the
common styling
mechanism. I
can’t use code
for one and
CSS for the
other.
<br>
<br>
Well,
technically I
could, but it
just wouldn’t
make any
sense.<br>
<br>
Best regards,
Pavel</span><o:p></o:p></p>
<div>
<p
class="MsoNormal"><span style="font-size:12.0pt">On 5/5/25 22:54, Andy
Goryachev
wrote:</span><o:p></o:p></p>
</div>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">You
have to use
highlights for
that, since
you can't
assign CSS
style to a
part of the
Text instance,
and you can't
set a
background on
it.</span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">JDK-8355774
is pretty high
on my list of
things to do.</span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy
</span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<div
id="mail-editor-reference-message-container">
<div>
<div>
<div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p
class="MsoNormal" style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span
style="font-size:12.0pt;color:black">openjfx-dev <a
href="mailto:openjfx-dev-retn@openjdk.org" moz-do-not-send="true">
<openjfx-dev-retn@openjdk.org></a> on behalf of PavelTurk <a
href="mailto:pavelturk2000@gmail.com" moz-do-not-send="true">
<pavelturk2000@gmail.com></a><br>
<b>Date: </b>Monday,
May 5, 2025 at
12:47<br>
<b>To: </b><a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true"
class="moz-txt-link-freetext">openjfx-dev@openjdk.org</a> <a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true">
<openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>Re:
CodeArea:
-fx-background-color
doesn't work.</span><o:p></o:p></p>
</div>
<p
class="MsoNormal" style="margin-bottom:12.0pt"><span
style="font-size:12.0pt">Hello, Andy<br>
<br>
Yes, I need to
add a
background
color for a
text segment
within a
paragraph
using CSS.
<br>
<br>
I have just
opened an
issue with ID
: 9078469.<br>
<br>
Can anyone
give an
estimate of
when this
issue might be
addressed?
Background
color is such
a fundamental
feature
<br>
that it's
impossible to
work without
it.<br>
<br>
Best regards,
Pavel</span><o:p></o:p></p>
<div>
<p
class="MsoNormal"><span style="font-size:12.0pt">On 5/5/25 22:09, Andy
Goryachev
wrote:</span><o:p></o:p></p>
</div>
<blockquote
style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Dear
Pavel:</span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Can
you clarify
what you are
trying to do
exactly?</span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">If
you are trying
to add a
background to
a text segment
within the
paragraph (as
your code seem
to indicate),
then the only
way to do it
is to call
Builder.addHighlight().</span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">If
you are trying
to set the
background of
the whole
paragraph,
you've hit
another
missing API
similar to
JDK-8355774 -
there is
currently no
way to style
the paragraphs
via CSS.
There is the
Builder.setParagraphAttributes(StyleAttributeMap)
but a CSS one
is missing.</span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy</span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<p
class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
<div
id="mail-editor-reference-message-container">
<div>
<div>
<div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p
class="MsoNormal" style="margin-bottom:12.0pt"><b><span
style="font-size:12.0pt;color:black">From:
</span></b><span
style="font-size:12.0pt;color:black">openjfx-dev <a
href="mailto:openjfx-dev-retn@openjdk.org" moz-do-not-send="true">
<openjfx-dev-retn@openjdk.org></a> on behalf of PavelTurk <a
href="mailto:pavelturk2000@gmail.com" moz-do-not-send="true">
<pavelturk2000@gmail.com></a><br>
<b>Date: </b>Saturday,
May 3, 2025 at
10:07<br>
<b>To: </b><a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true"
class="moz-txt-link-freetext">openjfx-dev@openjdk.org</a> <a
href="mailto:openjfx-dev@openjdk.org" moz-do-not-send="true">
<openjfx-dev@openjdk.org></a><br>
<b>Subject: </b>CodeArea:
-fx-background-color doesn't work.</span><o:p></o:p></p>
</div>
<div>
<p
class="MsoNormal"><span style="font-size:11.0pt">For styling CodeArea, I use exclusively style classes, and this is the foundation of my entire architecture.<br>
Today I tried to implement search highlighting (via background color), but it didn't work. Below is my test code.<br>
<br>
Can anyone tell me how to set the background color using CSS? For example, in RichTextFX's CodeArea,<br>
they have -rtfx-background-color.<br>
<br>
public class JfxCodeArea extends Application {<br>
<br>
@Override<br>
public void start(Stage primaryStage) throws Exception {<br>
String text = """<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt<br>
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco<br>
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit<br>
in voluptate velit esse cillum dolore eu fugiat nulla pariatur.<br>
""";<br>
<br>
String css = """<br>
.test {<br>
-fx-font-weight: bold;<br>
-fx-fill: red;<br>
-fx-background-color: green;<br>
}<br>
<br>
""";<br>
String data = <span class="MsoHyperlink"><a class="moz-txt-link-rfc2396E" href="data:text/css;base64,">"data:text/css;base64,"</a></span> + Base64.getEncoder().encodeToString(css.getBytes(StandardCharsets.UTF_8));<br>
<br>
CodeArea codeArea = new CodeArea();<br>
codeArea.getStylesheets().add(data);<br>
<br>
codeArea.setSyntaxDecorator(new SyntaxDecorator() {<br>
@Override<br>
public RichParagraph createRichParagraph(CodeTextModel model, int index) {<br>
var builder = RichParagraph.builder();<br>
builder.addWithStyleNames(model.getPlainText(index), "test");<br>
return builder.build();<br>
}<br>
<br>
@Override<br>
public void handleChange(CodeTextModel m, TextPos start, TextPos end, int charsTop, int linesAdded, int charsBottom) {<br>
<br>
}<br>
});<br>
<br>
VBox.setVgrow(codeArea, Priority.ALWAYS);<br>
var button = new Button("Go!");<br>
button.setOnAction(e -> codeArea.setText(text));<br>
VBox root = new VBox(codeArea, button);<br>
Scene scene = new Scene(root, 600, 200);<br>
primaryStage.setScene(scene);<br>
primaryStage.show();<br>
<br>
}<br>
<br>
public static void main(String[] args) {<br>
launch(args);<br>
}<br>
}<br>
<br>
Best regards, Pavel</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<p
class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
<p
class="MsoNormal"><span style="font-size:12.0pt"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>