Target text on JavaFX UI controls through CSS

Here’s a small post on how you can target text on UI controls through CSS.

Just do this:

<control> .text
{
    /* CSS targeting the text in the UI control */
}

To change the text appearance on any of the JavaFX controls.

Example (adding a drop shadow to the text on a button):

.myButton .text {
    -fx-effect: dropshadow( one-pass-box , rgba(100, 100, 100, 0.5) , 0, 0.0 , 0 , 1 );
}

Result:

I think this is a very nice way to style text on UI controls, one which is not available on regular “Web HTML CSS”.

7 thoughts on “Target text on JavaFX UI controls through CSS

  1. Great website. А ⅼot ߋf ᥙseful info heгe.
    I’m sending it to somke friends ans aⅼso sharing in delicious.
    And certainly, thank youu fоr yⲟur effort!

  2. Нello, Neatt post. Thегe’ѕ an issue with your web site in internet explorer, ϲould test
    this? ΙE still is the marketplace leader and ɑ largе componwnt to folks will pass оѵеr youг
    greqt writing due to tҺis problem.

  3. Thanks for one’s marvellous posting! I definitely enjoyed reading it,
    you can be a great author. I will remember to bookmark your blog and will eventually come back in the foreseeable future.
    I wnt to encourage that you continue your great posts, have a nice holiday weekend!

Leave a Reply