Is it possible to set a JavaFX static property in CSS?

前端 未结 2 866
遥遥无期
遥遥无期 2021-01-21 00:54

Sample FXML with the BorderPanel.alignment \"static property\":


  
    
相关标签:
2条回答
  • 2021-01-21 01:06

    You can apply it programatically. For example if you want to center all the widgets of a GridPane, instead of writing GridPane.halignment="CENTER" in the XML declaration of each widget, you can do this in Java :

    for(Node node : gridPane.getChildren())
    {
        GridPane.setHalignment(node, HPos.CENTER);
    }
    

    Unfortunately I don't think you can factorize layouts as in Android :(

    0 讨论(0)
  • 2021-01-21 01:27

    For JavaFX versions 2.0 to 2.2 => no you cannot set the static layout properties via css.

    You can create a feature request in the JavaFX jira to ask this functionality be implemented in a future JavaFX version.

    0 讨论(0)
提交回复
热议问题