diff --git a/Classes/css/user/ContainerScrollStyleSheet.java b/Classes/css/user/ContainerScrollStyleSheet.java index f47f265..17e6d9e 100644 --- a/Classes/css/user/ContainerScrollStyleSheet.java +++ b/Classes/css/user/ContainerScrollStyleSheet.java @@ -2,11 +2,17 @@ package Classes.css.user; import Classes.css.core.Context; import Classes.css.core.Ruleset; +import javafx.beans.value.ChangeListener; +import javafx.beans.value.ObservableValue; +import javafx.geometry.Bounds; import javafx.scene.Node; +import javafx.scene.control.ScrollPane; +import javafx.scene.layout.FlowPane; public class ContainerScrollStyleSheet{ /* Builds all necessary CSS/layout rules */ + @SuppressWarnings({ "unchecked", "rawtypes" }) public ContainerScrollStyleSheet(Node target) throws Exception{ /* (1) Set rules */ @@ -16,6 +22,22 @@ public class ContainerScrollStyleSheet{ .add("right", 0) // .add("pref-height", ) .apply(); + + /* (2) Manage dynamic 1st children bounds to it */ + ScrollPane spane = (ScrollPane) target; + + spane.layoutBoundsProperty().addListener(new ChangeListener(){ + + @Override + public void changed(ObservableValue observable, Object oldValue, Object newValue) { + System.out.println(spane.getLayoutBounds().getWidth()); + FlowPane child = (FlowPane) spane.getContent(); + child.setPrefWidth( spane.getLayoutBounds().getWidth() ); + child.setPrefHeight( spane.getLayoutBounds().getHeight() ); + + } + }); + } } diff --git a/fxml/model.fxml b/fxml/model.fxml index 1315751..1f8381b 100644 --- a/fxml/model.fxml +++ b/fxml/model.fxml @@ -312,7 +312,7 @@ - +