0

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;
}

誰でも助けることができますか?

4

1 に答える 1

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に。

于 2015-08-12T23:04:12.987 に答える