javafx 2.0 adding border to Label

css, java, javafx-2, user-interface

Solution

Can you try:

System.out.println(label);

it should print something like

Label@1858c80c[styleClass=label]

Is your css class printing too after styleClass=label ... ? Or can you remove css class of the label and try setting the label style in code directly by:

label.setStyle("-fx-border-color: white;");

if you can see the changes then maybe you are unintentionally overriding css class definiton in css file. Check it.

Problem

I have a label with style class "test" in my javafx application. I wanted to add white border around this label, so in the css file I tried: ``` -fx-border-width: 2; -fx-border-color: white; ``` but that didnt worked so then i tried to add: ``` -fx-border-style: solid; ``` but that didnt worked either, following javafx css reference I didn't find anything useful. what am I doing wrong?

Original source