How do I add margin to a JavaFX element using CSS?

前端 未结 2 458
北恋
北恋 2020-12-10 01:09

I have the following fragment of FXML:


             


        
2条回答
  •  时光取名叫无心
    2020-12-10 01:51

    It seems you cannot. JavaFX has a limited support on CSS right now.

    However, the CSS padding and margins properties are supported on some JavaFX scene graph objects.

    says the official CSS Reference Guide. So workaround could be to use extra other layout, another VBox for instance:

    
        
            
            

    Update:
    Found a bit more perfect way of doing it, but still not by CSS.

     
    
     
            
            
            
     
    

    This avoids defining an unnecessary extra layout.

提交回复
热议问题