3

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.

oldvipera
  • 305
  • 4
  • 8
  • 16
  • this is the thing that i want. I just want to change a part of the scene not the whole scene. Lets say there are buttons at one side and when clicked the options are shown at the other side – oldvipera Dec 25 '13 at 15:56
  • Possible duplicate of [How to change sub fxml gui parts at runtime with Button Click](https://stackoverflow.com/questions/11563298/how-to-change-sub-fxml-gui-parts-at-runtime-with-button-click) – georgeawg Jul 11 '18 at 21:17

2 Answers2

2

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.

dinith jayabodhi
  • 531
  • 2
  • 8
  • 19
1

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);
ali sampson
  • 321
  • 4
  • 7