• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Moving User through Scenes

 
Parrish Myers
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an equations program that I'm working on, which randomly selects one of 50 equations, then takes the user through a series of scenes in order to solve it. Once the user solves the equation, they're asked if they want another equation. If they answer no, the program closes. If they answer yes, the program is supposed to randomly select another equation, then take them through the scenes to solve that one.

The program works just as I want it to the first time through. However, if the user selects "yes" for another equation, the program displays the END of the first scene, showing them the previous problem that they've already solved.

How can I send the user to the beginning of the scene, so that a new equation is selected?

Here is the code for the first scene:



Here’s the event handler that’s supposed to send them back to the start of Stage 1:
 
John Damien Smith
Ranch Hand
Posts: 296
14
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use a wizard which has basic navigation support.

Here is some wizard sample code:
https://gist.github.com/jewelsea/2850787

You might not be able to apply it directly to your problem, but, if not, the code may still give you some ideas on how you might solve the problem yourself.

ControlsFX also includes a wizard implementation:
http://controlsfx.bitbucket.org/org/controlsfx/dialog/Wizard.html

There is a really basic scene navigation framework for FXML here:
https://gist.github.com/jewelsea/6460130
Though you aren't using FXML so that probably doesn't directly apply.

Note: in the code you supply in your question there is only one scene created, so "sending the user to the beginning scene" does not make any sense as the beginning scene is the ending scene so there is nowhere to send the user because they are already at the destination. I am using Scene literally in the JavaFX sense. You are not creating new scenes when you display new questions, you are just replacing question content within the existing scene. So rather than changing the scene, you need to change the content of the scene to be the first question rather than the last.

There may be other issues with you code which are causing you problems.
 
Parrish Myers
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response.

Concerning scenes, there are two additional scenes that the user moves through, but the problem I have is sending them back to scene1. I was afraid of posting too much code, thereby losing the point of what I needed help with.

I will look at these links you've offered.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic