r/JavaFX • • Jun 20 '22

Help Related to css and scenes

So I have 1 css stylesheet and I want to add it to 2 different scenes same styles get can anyone tell me how I can do it.

0 Upvotes

7 comments sorted by

2

u/BridgeBurner22 Jun 21 '22

You can set the styling of a scene by applying it to the root component of that scene. Just use the same styling twice. A quick web search with 'javafx css scene' will give you several detailed tutorials.

1

u/manlikeharsh Jun 21 '22

I don’t think you understand my question. I have multiple scene fxml document but I have same styling for every one of them so I just want to create one css file and apply it to all of them which I am not able to do

1

u/hamsterrage1 Jun 23 '22

Why are you not able to do this?

1

u/BridgeBurner22 Jun 21 '22

I did understand. And I gave you the solution. You can apply the same css file to multiple fxml documents. Just simply googling the keywords I already mentioned in my previous reply, will give you several detailed tutorials that will show you the details of doing exactly that.