Specifying the underline offset
JavaFX css does not have a text-underline-offset attribute as far as I know. You could display the link in a WebView and configure the offset using web css rather than JavaFX css, but I wouldn't really recommend that.
JavaFX private implementation uses an underline offset , but that is not public API and cannot be controlled via public API, so I don't think that helps you.
Related info on clickable text (hyperlinks)
For clickable text, you should use a Hyperlink rather than a Label.
See the Hyperlink tutorial and css .
Hyperlink, by default only displays an underline on hover, to have it always displayed, see the related question:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.