Как избавиться от белой рамки вокруг JavaFX Textview

У меня есть белая рамка вокруг TextArea, от которой я не могу избавиться

введите здесь описание изображения

Вот код:

    textArea = new TextArea();
    textArea.getStyleClass().add("textArea");
    textArea.setWrapText(true);

И CSS:

.textArea{
-fx-background-insets: 0 0 0 0, 0, 1, 2;
-fx-background-radius: 0;
-fx-text-fill: white;
-fx-border-color: #2a2a2a;
-fx-border-width: 0;}

.textArea .content{
    -fx-background-color: #2a2a2a;
    -fx-border-color: #2a2a2a;
}

Кто-нибудь может помочь?


person Josh Beaver    schedule 12.08.2015    source источник


Ответы (1)


Это работает в моем тестовом примере:

.text-area, .text-area .content {
    -fx-background-color: #2a2a2a ;
    -fx-background-radius: 0 ;
}
.text-area {
    -fx-text-fill: white ;
}

Тестовый код:

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class TextAreaBorderTest extends Application {

    @Override
    public void start(Stage primaryStage) {
        TextArea textArea = new TextArea();
        BorderPane root = new BorderPane(textArea);
        root.setPadding(new Insets(24));
        Scene scene = new Scene(root);
        scene.getStylesheets().add("text-area-border-test.css");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}

я добавил

.root {
    -fx-background-color: black ;
}

в CSS для проверки.

person James_D    schedule 12.08.2015
comment
Это было .text-area, .text-area .content, что имело значение - person Josh Beaver; 13.08.2015