Search code examples
javafxjavafx-css

How to remove a line of shadow under javafx button


Using JavaFX 15

There's a line of shadow below the border of the JavaFX FXML button. is it possible to make it transparent using CSS? As I do not know which attribute it belongs to.

Picture of the button attached below

.btn{
    -fx-background-color: black;
    -fx-background-radius: 30px;
    -fx-border-color: white;
    -fx-border-radius: 30px;
    -fx-border-width: 3px;
}

colored with black background and white borderline for visibility

picture of the shadow line under the button


Solution

  • It is possible that what you are seeing is the background spilling out past the border. Since you have customized the border thickness in the CSS, you may also need to adjust background insets.

    See the CSS docs for Region https://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#region