Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JavaFX and the fly likes Submitting form data to a new screen using javafx Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "Submitting form data to a new screen using javafx" Watch "Submitting form data to a new screen using javafx" New topic
Author

Submitting form data to a new screen using javafx

Chris Creed
Ranch Hand

Joined: Feb 27, 2009
Posts: 67

I'm currently working on a desktop app using javafx. IN the introductory screen, I have a form where the user would fill in various information, and then submit the form contents to a new screen, discarding the old screen as the user would not be heading back there in the application logic flow. However I'm at a loss as to how this would be done. I was thinking it would be like Android where I could call a get new screen function, calling the class for the new screen's constructor and it'd pass over to there, but when trying that, it just created a new window, which obviously isn't what I'm after. Was wondering if anyone knew of a better way that I could move the application to a new screen, and still easily pass the form information over to that screen for further processing.
John Damien Smith
Ranch Hand

Joined: Jan 26, 2012
Posts: 133
    
    9
I think this question is (essentially) a duplicate of another coderanch question:

switch between scenes (not stage) in javafx

Have a look over the links in the answers to that question and see if it answers your question.

Jamie Coleshill
Greenhorn

Joined: Oct 18, 2013
Posts: 8

I would use FXML and make multiple scenes. If you are not to sure on how to handle multiple scenes, I would suggest you goto the following two links and read over them.

Angela's Blog
getting started with javafx


I myself made a login screen based somewhat on those codes as well as another one that I cant remember at the moment, but how I went about it is as follows...

Key parts in my main class are




This is only part of the code I have used and is also only from my main class, but what I have done is when the program starts it does the gotoLogin first. The login screen's controller is made aware of the main screen via the method shown in Angela's blog, and when a user successfully logs in the controller calls on the main screen's method of gotoClientHome and pass it a user object. In your case you would be passing the information that the user had entered.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Submitting form data to a new screen using javafx
 
Similar Threads
Passing data from jsp to jsp
Having forms and tables in success page and send it to action class on submit ?
MVC & Swing - How model classes work together ?
Non Struts App -> Struts App - use splash screen and auto forward?
Opening a new browser window from the applet and supplying data via POST