lundi 2 mars 2015

Using braces for parental organization in JavaFX



I'm writing a user interface in JavaFX and would prefer not use FXML. Is it conventionally and efficiently sound to organize children using braces as follows? The braces serve no purpose other than to make the code look better. Will the braces be entirely optimized away when compiled?



HBox top = new HBox();
{
Label white = new Label("White");
white.getStyleClass().addAll("white-check");
white.setMinWidth(160);
white.setMinHeight(60);

Label lightGray = new Label("Light Gray");
lightGray.getStyleClass().addAll("lightgray-check");
lightGray.setMinWidth(160);
lightGray.setMinHeight(60);

top.getChildren().addAll(white, lightGray);
}


Let me know if I should migrate this to programmers SE.


Thanks.




Aucun commentaire:

Enregistrer un commentaire