如何在JavaFX中将圆角设置为TextArea?

时间:2018-04-02 19:43:59

标签: javafx

我需要在TextArea上有圆角,但看起来有点奇怪。似乎,一些内层也应该有相同半径的圆角,但是哪一个?

我使用这个CSS:

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

它看起来像这样: TextArea corners

2 个答案:

答案 0 :(得分:0)

你可以关注这个。希望这应该有所帮助。

.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. */
 }

答案 1 :(得分:0)

似乎我需要发布这个问题,以便自己找到解决方案: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;
}
相关问题