0

I have a white border around my TextArea that I cannot get rid of

enter image description here

Heres the code:

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

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

Can anyone help?

Josh Beaver
  • 127
  • 8
  • 18

1 Answers1

1

This works in my test case:

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

Test code:

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

I added

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

to the CSS in order to test.

James_D
  • 201,275
  • 16
  • 291
  • 322