3

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?

1
  • After quite a lot of messing about, the issue was with the background color rather than the border (the background was appearing as a border). As for changing the individual borders, the color for the border on each side of the control can be set individually:-fx-border-color: top right bottom left; You can set the color to be transparent to get rid of the border. Commented Jan 20, 2013 at 18:33

1 Answer 1

0

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,

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.