The problem in Java FX when we hide controls is that once we set it to setVisible(false), the control will be hidden yes. But its bounded space will still be in effect and it would look pretty ugly seeing a huge empty area in your user interface.

While some have suggested placing it in an HBox or VBox and removing and adding them when needed, the better solution for me is to call this control.managedProperty().bind(control.visibleProperty()); before any calls to setVisible() whether you want to hide it or not.

Once that is called, when you hide a control, its bounded space will be removed from the user interface as well making it look like it is not there at all.

Related Posts Plugin for WordPress, Blogger...