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.
As James says, your approach is totally sound.1 person found this helpful
If you want to do the animation James describes, there is a sample here:
though it is just eye candy and probably a power user would want to skip the animation and have an instant transition.
Thank you very much James and JSmith for your input! I appreciate it. In my initial experimentation I did try using a Grid Pane container, but I could not get it to work like I wanted. I will give it another try, based on your insight.