show hide panel in javafx using fxml
11,899
Solution 1
you can use the following code and hide the panes you want to hide
(paneid).setVisible(false);
and appear the new code
(paneid).setVisible(True);
here the id is the what you put for "fx:id" in scenebuilder.
Solution 2
What you can do is to write this code to hide the pane
(paneId).setVisible(false);
(paneId).setManaged(false);
and show it again by setting the parameters to true
(paneId).setVisible(true);
(paneId).setManaged(true);
![oldvipera](https://i.stack.imgur.com/izhM4.jpg?s=256&g=1)
Author by
oldvipera
Updated on July 21, 2022Comments
-
oldvipera almost 2 years
I have made the GUI of my javafx application in scenebuilder. I have correctly made the settings of placing the fxml and my application works perfect. Now I want to add action events to buttons and when a button is clicked, a panel should be shown and when other button is clicked, the other panel should be shown. Please help me. And remember that I am building my interface using scenebuilder i.e using fxml for my interface.
Thank you.