9

I'm just getting into using fxml and it seems like a really cool idea, except for the fact that I'm having a tough time getting it to work. Supposedly I'm able to lay out my GUI using a nice markup language, and I can style the elements via CSS. So I have a label on my GUI, and I would like there to be a solid black border around it, with width=1. Seems like this should be straightforward -- adapting examples I see here and there in tutorials, etc., I do the following:

<Label text="sample text" style="-fx-border-width: 1; -fx-border-style: solid;" />

But it doesn't work. No border appears. In the Scene Builder there is a text box labelled "Style" in the properties inspector, and I can see the style I have applied appear there, but I don't see a border.

What am I overlooking?

tadasajon
  • 14,276
  • 29
  • 92
  • 144

1 Answers1

25

You need to specify the Border Color as well. Add this to your Label tab

-fx-border-color:black;

In your case the sample code will be :

<Label text="sample text" style=" -fx-border-color:black; -fx-border-width: 1; -fx-border-style: solid;" />
francisOpt
  • 860
  • 1
  • 8
  • 15
  • Excellent. Any insight on this one? http://stackoverflow.com/questions/18244943/javafx-fxml-how-do-i-set-the-default-selected-item-in-a-choicebox-in-fxml – tadasajon Aug 15 '13 at 02:53