File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

Submitting form data to a new screen using javafx

Chris Creed
Ranch Hand

Joined: Feb 27, 2009
Posts: 69

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: 227
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

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.
I agree. Here's the link:
subject: Submitting form data to a new screen using javafx
It's not a secret anymore!