JAVAFX: cannot find the relative path to a file

I need to add the file style.css as stylesheet to a scene. I am trying to do this inside the class ScreenController which is in the package justAnotherChessGame.model. The file is in the same directory but in a different package. How can I find the relative path? Project structure


If your scene is sc and pane is p in ScreenController,

Scene sc = new Scene(p, 400, 300);

You need to study about this case.

Leave a Reply

Your email address will not be published. Required fields are marked *