Ben Guest
Ben Guest

Reputation: 1568

JavaFX fxml default css border on some controls

I am trying to use JavaFX Scene Builder to create the UI for my application. I am using a CSS file to style controls in my interface. I have noticed that some controls (TableView, TreeView) have a default grey border which I don't want.

I have tried setting the -fx-border-style: none; and the -fx-border-width: 0; neither of which have worked. I then tried to set the border color for individual sides (-fx-border-right-color:#FFF;) but this did not work either. The only thing I can change is the border color for all sides.

Does anyone know how to get rid of the default border, and also how to style the border for individual sides of these controls?

Upvotes: 3

Views: 3334

Answers (1)

Chris
Chris

Reputation: 15651

for me the following worked:

TreeView tv = (TreeView) scene.lookup("#myTree");

// ... setup your tree

tv.setStyle("-fx-border-style: none; -fx-background-color:transparent;");

HTH,

Upvotes: 0

Related Questions