Skip to main content

Posts

Showing posts from July, 2018

Where to Place External CSS File

The following is what a lot of tutorials recommend to specify the CSS file in JavaFX scene.getStylesheets().add("myStyle.css") ; But where do you place the "myStyle.css" file? A JavaFX project typically is located as follows (using Netbeans): C:\Users\UserName\Documents\NetBeansProjects\JavaFXProjectFolder Insider the project folder, you will find the following: Don't place your CSS file in " src " which is where many tutorial tell you to place the CSS file. You will loose your hair prematurely  due to excessive scratching as you try to convince your app to find your CSS. Instead, open the " build " folder inside which you will find: Place your CSS file in the " classes " folder that contains compiled Java classes. It will look like this: Best wishes with you JavaFXing.