I want to make text strikethrough using CSS.
I use tag:
button.setStyle(\"-fx-strikethrough: true;\");
But this code is working, please
Button does not support the -fx-strikethrough
CSS property, so setting this has no effect.
Here is the official JavaFX 8 CSS reference: JavaFX CSS Reference Guide
The -fx-strikethrough
is defined for the Text
node.
Button
only supports the following: cancel
, default
, and all inherited from Labeled
:
-fx-alignment, -fx-text-alignment, -fx-text-overrun, -fx-wrap-text, -fx-font,
-fx-underline, -fx-graphic, -fx-content-display, -fx-graphic-text-gap,
-fx-label-padding, -fx-text-fill, -fx-ellipsis-string
And Labeled
inherits these from Control
: -fx-skin
, -fx-focus-traversable
.
So looking at the supported properties, the following works (of course it's not strikethrough):
button.setStyle("-fx-underline: true");