This content has been marked as final. Show 3 replies
That's more or less what I'd do.
You can use a GridPane instead of the nested HBoxes and VBoxes. This way you can set the GridPane constraints on the charts at creation time; those constraints will remain set even when you remove them from the GridPane (so the charts essentially remember their locations in the GridPane). Then your mouse handler just adds or removes them from the grid pane, and doesn't have to worry about where they go. This might simplify it a bit.
This would be more work (not sure how tricky), but you could also consider setting all the charts minimum height and width to zero when they're created, and then setting the maximum height and width to zero to "hide" them. The (only) advantage to this is that you could animate the changes to the maximum width/height properties, which would create some nice eye-candy.