Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Where to start for JavaFX newbie??

achanaMay 27 2019 — edited Jun 3 2019

QUESTION:

How do I move from one scene to the next and pass the data from another class to the getter-setter class so I can re-use the same data in other scenes??

SIMPLEST REQUEST :

Please point me to more detailed documentation on how to move data from the observable list of one class to the getter-setter class.

I am okay with the controls and the nodes etc, but I need documentation on switching scenes, preferably without using FXML b/c the current software eco-sphere is quite big without introducing more, but will use FXML if I cannot code the scene- views in JavaFX.

Message was edited by: achana The codes have been removed b/c at this stage, they are not relevant, I just need a pointer to documentation that will help me understand navigating the scenes and passing data from one scene to the nextr, preferably using the ol getter-setter.

Comments

bouye-JavaNet

Hi,

passing values from 1 class to another (or 1 part of your program to another) is just a basic Java issue and has little to do with JavaFX itself. You either pass them as parameters of the new class constructor or as parameters when you invoke setters or other methods, your choice. You know how to do that in regular / basic Java (or even in other programming languages)? Then it's exactly the same in JavaFX, no special trick involved...

As for switching scene, if that is needed (because frankly there's little point into switching the entire scene when you just can switch the scene's content), you just have to replace the scene reference in the stage with a new one by calling myStage.setScene(). That's it, there is nothing strange or complex when doing that.

You prefer to no use FXML, OK no worries, it works the same with or without FXML...

So I really do not see what are your issues here... Why not try to do small test programss by yourself to experience that. There is nothing special in the questions you've just asked.

1 - 1

Post Details

Added on May 27 2019
1 comment
251 views