4

Getting a bold label in JavaFX should be as simple as:

<Label text="Some bold text" style='-fx-font-weight: bold'/>

but it seems it is not.

Looking thru some Q&A in stackoverflow i found:

which show that people get mixed mileage. There are a few thousand views on most of these questions but only a few upvotes and comments with mixed results. In some contexts things seem to run fine in others not at all. Unfortunately i am on the "not at all" side on my Mac OS High Sierra with

java version "1.8.0_152"

So i wonder what the reason is that things do not work "out of the box" and whether there is a valid platform independent work-around or we just have to put up with this unhappy situation.

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
  • For a workaround https://stackoverflow.com/a/18409438/1497139 seems to help I am using .root{ -fx-font-size: 14pt; -fx-font-family: "Arial"; } – Wolfgang Fahl Feb 23 '20 at 10:06

1 Answers1

3

Bugs:

to work around it set a default font that supports bold in your css e.g.

.root{
    -fx-font-size: 14pt;
    -fx-font-family: "Arial";
}
Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186