Search code examples
javacssjavafxprojectscenebuilder

In scene builder, i am adding css file and facing the following issue: css file is not implemented and displayed


I've added css file but it didn't work in scene builder. My expectation is to display the css file implementation in scene builder:

. gradient{
-fx-backcolor-linearback (in right bottom #89092,#82229);
}


Solution

  • I think you have couple of issues:

    1. CSS property -fx-backcolor-linearback doesn't exist in JavaFX CSS. Instead, you can use the -fx-background-color property to set the background color.

    2. check for syntax errors in values for the background color in your code.

    3. let's say you are trying to set a gradient background color in JavaFX using CSS, you can write the code as following:

      .gradient {-fx-background-color: linear-gradient(to bottom right, #89092, #82229);}