Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add border around VBox in javafx?

IS it possible to add a borderline around a whole content of a VBox in Javafx?

Meaning i have added a lot of components already in tis VBox but want to have a border around it?

So if i have the css file like this:

#vbox_style {
    -fx-border-color: black;
    -fx-border-insets: 5;
    -fx-border-width: 3;
    -fx-border-style: dashed;
 }

How could i get this Resource, where do the file need to be located to use method as: myBox.setId("vbox_style");

like image 605
Mikael Avatar asked Nov 10 '15 09:11

Mikael


1 Answers

You can set a custom CSS style on the VBox:

String cssLayout = "-fx-border-color: red;\n" +
                   "-fx-border-insets: 5;\n" +
                   "-fx-border-width: 3;\n" +
                   "-fx-border-style: dashed;\n";

VBox yourBox = new VBox();   
yourBox.setStyle(cssLayout);
like image 106
user1438038 Avatar answered Oct 12 '22 19:10

user1438038