Javafx 2 如何从文本区域边框中删除阴影

Javafx 2 如何从文本区域边框中删除阴影,javafx-2,javafx,javafx-8,Javafx 2,Javafx,Javafx 8,我想创建带有黑色边框的文本区域 TextArea dataPane = new TextArea(); dataPane.setStyle("-fx-border-color: black; -fx-border-width: 1; -fx-border-radius: 16;"); 但我得到的结果是: 您能告诉我如何删除此蓝色阴影吗?蓝色边框不是阴影,而是控件的里海样式的默认焦点颜色。您可以在caspian.css中看到它的定义为-fx focus color,默认值为\0093ff 现在

我想创建带有黑色边框的文本区域

TextArea dataPane = new TextArea();
dataPane.setStyle("-fx-border-color: black; -fx-border-width: 1; -fx-border-radius: 16;");
但我得到的结果是:


您能告诉我如何删除此蓝色阴影吗?

蓝色边框不是阴影,而是控件的里海样式的默认焦点颜色。您可以在caspian.css中看到它的定义为
-fx focus color
,默认值为
\0093ff

现在我们可以覆盖每个控件的调色板。你也是

dataPane.setStyle("-fx-border-color: black; -fx-border-width: 1; "
                + "-fx-border-radius: 16; -fx-focus-color: transparent");

蓝色边框不是阴影,而是控件的里海样式的默认焦点颜色。您可以在caspian.css中看到它的定义为
-fx focus color
,默认值为
\0093ff

现在我们可以覆盖每个控件的调色板。你也是

dataPane.setStyle("-fx-border-color: black; -fx-border-width: 1; "
                + "-fx-border-radius: 16; -fx-focus-color: transparent");

如果要完全删除所有边框、阴影和高光:

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

.text-area .content {
    -fx-background-color: transparent, white, transparent, white;
}

.text-area:focused .content {
    -fx-background-color: transparent, white, transparent, white;
}

.text-area:focused {
    -fx-highlight-fill: #7ecfff;
}

.text-area .content {
    -fx-padding: 10px;
    -fx-text-fill: gray;
    -fx-highlight-fill: #7ecfff;
}

如果要完全删除所有边框、阴影和高光:

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

.text-area .content {
    -fx-background-color: transparent, white, transparent, white;
}

.text-area:focused .content {
    -fx-background-color: transparent, white, transparent, white;
}

.text-area:focused {
    -fx-highlight-fill: #7ecfff;
}

.text-area .content {
    -fx-padding: 10px;
    -fx-text-fill: gray;
    -fx-highlight-fill: #7ecfff;
}

使用chrome进行检查您将发现-webkit或-moz值已设置您需要覆盖使用ur reset css的值使用chrome进行检查您将发现-webkit或-moz值已设置您需要覆盖使用ur reset css的值