I would like to add a CSS file which is located somewhere on the filesystem. The purpose is to write an application where the user can add JavaFX CSS files (which are create
You can get the URL from java.io.File
java.io.File
File file = new File("style.css"); URL url = file.toURI().toURL(); scene.getStylesheets().add(url.toExternalForm());
or in short form
scene.getStylesheets().add((new File("style.css")).toURI().toURL().toExternalForm());