Vadym
Vadym

Reputation: 101

How to set rounded corners to TextArea in JavaFX?

I need to have rounded corners on TextArea, but it looks a bit weird. Seems, some inner layer should also have rounded corners with the same radius, but which one?

I use this CSS:

.text-area {
    -fx-background-color: #dbb1b1, #fff0f0;
    -fx-background-radius: 15;
    -fx-border-radius: 15;
    -fx-border-color: red;
}

And it looks like this one: TextArea corners

Upvotes: 3

Views: 5656

Answers (2)

Vadym
Vadym

Reputation: 101

Seems I was needed to post this question in order to find solution by myself :D

.text-area .scroll-pane {
    -fx-background-color: transparent;
}
.text-area .scroll-pane .viewport{
    -fx-background-color: transparent;
}
.text-area .scroll-pane .content{
    -fx-background-color: transparent;
}

Upvotes: 5

Mushfiqur Mashuk
Mushfiqur Mashuk

Reputation: 21

You can follow this.Hope this should help.

.text-area {
  -fx-border-radius: 10 10 0 0;
  -fx-background-radius: 10 10 0 0;

  /* top-left, top-right, bottom-right, and bottom-left corners, in that 
  order. */
 }

Upvotes: 1

Related Questions