1

I'm actually trying to use CSS with JavaFx and i'm getting an error. I've created the CSS file(style.css) and now trying to add the file to the fxml file through stylesheets and i am getting this error below

com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged WARNING: Resource "@style.css" not found.

This is the FXML file with the code below

<GridPane fx:controller="sample.Controller"
      xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10"
           stylesheets="@style.css">
      <Button text="Button One" GridPane.rowIndex="0" GridPane.columnIndex="0"/>
     <Button text="Button Two" GridPane.rowIndex="0" GridPane.columnIndex="2"/>

     <Button text="Button Three" GridPane.rowIndex="0" GridPane.columnIndex="3"/>

     <Button text="Button Four" GridPane.rowIndex="0" GridPane.columnIndex="4"/>

     <Button text="Button Five" GridPane.rowIndex="0" GridPane.columnIndex="5"/>
</GridPane>

I don't know if i need to add a path or a jar file somewhere. I just please need somebody's help to fix this so that i can continue with my learning. Thanks so much. I really appreciate.

alt
  • 51
  • 1
  • 6

1 Answers1

0

As the error suggests, it cant find an stylesheet. Refer to the link given, might clear the error.

How load css file in javafx8

HugoS
  • 105
  • 11
  • Thanks bro. Though i didn't go through this method but it was helpful. I've been doing more research's also and i found out i needed this( / ) to the stylesheet and it worked. I'd be drooping the answer here also if it is needed by someone else I can't add up all the code but his right here is the solution. – alt Jul 19 '20 at 22:59