I'm doing an application with JavaFX and would like to put CSS in an external file, for example, the file would be located in the "C: \ app \ css" directory.
Is it possible to recognize the external file?
I'm doing an application with JavaFX and would like to put CSS in an external file, for example, the file would be located in the "C: \ app \ css" directory.
Is it possible to recognize the external file?
Use the instance of class Scene
, example:
Scene cena = new Scene(Parent);
cena.getStylesheets().add(getClass().getResource("Caminho_Para_O_Arquivo"));
If this does not work, try this:
cena.getStylesheets().add(getClass().getResource("Caminho_Para_O_Arquivo").toExternalForm());