Search code examples
javajavafx

The issue is with the top shadow in the TextArea


enter image description hereI am trying to beautify a TextArea, but there is always a shadow at the top of the TextArea that I want to eliminate. This is my CSS code:

.text-area-ui{
    /*-fx-effect: innershadow(one-pass-box, rgba(128, 128, 128, 0.67), 5, 0, 1, 1);*/
    -fx-background-radius: 3;
    -fx-background-color: white;
}
.text-area-ui:focused{
    /*-fx-effect: dropshadow(two-pass-box, #0075FF, 5, 0, 1, 1)!important;*/
}
.text-area-ui .content {
    -fx-background-insets: 0;
}

I have consulted the JavaFX CSS documentation, but I cannot resolve it.


Solution

  • If you check the hierarchy of text area as in below image, the shadow is actually the background color (gradient) of ContentView.

    enter image description here

    So to turn if off, just set the ContentView background color to white in your current css.

    .text-area .content {
        -fx-background-insets: 0;
        -fx-background-color:white;
    }