Skip to content
Advertisement

How to use the custom CSS in JavaFX without getting warning?

I am working on making a custom style for the label but when I’m calling it I’m getting the following warning Feb 06, 2021 7:54:12 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged WARNING: Resource “@Field-background” not found. which doesn’t make my code to get the custom CSS effect.

MY Code:

JavaScript

MY CSS

JavaScript

Any Advise.

Advertisement

Answer

Your CSS selector .field-background is a class selector.
Thus you should be using getStyleClass on the userName instance.

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement