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.

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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 <GridPane fx:controller="sample.Controller" xmlns:fx="javafx.com/fxml" alignment="center" hgap="10" vgap="10" stylesheets="@/style.css"> I can't add up all the code but his right here is the solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.