I am using Java FX for a desktop application.Can i change a scene inside one scene?First scene has an anchorpane inside which one another anchor pane is included.Can i change the scene in the second anchorpane?
Asked
Active
Viewed 1,812 times
0
-
https://stackoverflow.com/questions/30901185/difference-between-pane-and-group using AnchorPane in Group can help you in switching scenes. – Talha May 02 '18 at 18:30
1 Answers
1
just load AnchorPane inside Anchorpane. no need of creatinig new scene..
AnchorPane main=new AnchorPane();
AnchorPane sub=new AnchorPane();
sub.getChildren().add(btn);
main.getChildren().add(sub);
Scene is super class to Node so i think its impossible to load scene inside Scene. however u can switch scenes in a stage.

Vinod CG
- 1,041
- 4
- 15
- 24
-
1rak seems to be asking if you can change the content inside the second anchorpane (I guess dynamically). Which can be done by applying vini's solution and then later, in response to some UI or other event, calling sub.getChildren().clear() followed by sub.getChildren().add(newbtn). – jewelsea Apr 05 '12 at 20:11