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.

2
  • 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 Commented Dec 25, 2013 at 15:56
  • Possible duplicate of How to change sub fxml gui parts at runtime with Button Click Commented Jul 11, 2018 at 21:17

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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); 

1 Comment

Alright @kleopatra, thanks for the correction. I have updated my answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.