CSS 形状不适用于 javafx 中的文本区域

CSS for shape does not apply on textarea in javafx

我正在申请以下 CSS。

.text-area .content {
    -fx-background-color: -lined-back;
    -fx-shape: "M 7 0 L 24 0 L 24 19 L 0 19 L 0 2 L 7 2 Z";
}

.text-area:focused .content {
    -fx-shape: "M 7 0 L 24 0 L 24 19 L 0 19 L 0 2 L 7 2 Z";
}

我的问题是它只改变了背景的形状而不是整个 component.and 也开始编辑 point.as 每个下面的图像。

你有HTML这些样式适用吗?我对 javafx 一无所知,但您目前的目标是 .text-area 内的 .content。您可能只需要定位 .text-area 本身:

.text-area,
.text-area .content {
    -fx-background-color: -lined-back;
    -fx-shape: "M 7 0 L 24 0 L 24 19 L 0 19 L 0 2 L 7 2 Z";
}

.text-area:focused,
.text-area:focused .content {
    -fx-shape: "M 7 0 L 24 0 L 24 19 L 0 19 L 0 2 L 7 2 Z";
}

您甚至可以 定位 .text-area,因为我认为它的子项会受到其形状的限制。

.text-area {
    -fx-background-color: -lined-back;
    -fx-shape: "M 7 0 L 24 0 L 24 19 L 0 19 L 0 2 L 7 2 Z";
}

.text-area:focused {
    -fx-shape: "M 7 0 L 24 0 L 24 19 L 0 19 L 0 2 L 7 2 Z";
}