This content has been marked as final. Show 3 replies
Actually neither rect.setStyle("-fx-fill: red"); doesn't works. In normal java application it all works.
Admittedly, the stylesheet path handling is pretty bad. If you can see the .css file in your browser, then you have a valid URL. You can also use Class.getResource("blah").toExternalForm() to get the right URL string. For example, if I have my .css file in the same directory as Main.java, then I could do
If I do what you posted it still doesn't work. I don't understand why also rect.setStyle("-fx-fill: red"); doesn't works. At least this should works.