This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JavaFX and the fly likes Form get input data 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 "Form get input data" Watch "Form get input data" New topic
Author

Form get input data

naro pad
Ranch Hand

Joined: May 07, 2008
Posts: 58

Hi,
I am have just started my first javafx application and I have the following easy issue:

I have the following javafx fxml file


Now I want to bind this 4 fields to an object and use this object on the fxml controller class to pass the data entered on the form into the database .I have tried to find related examples on the Internet but without any luck. Can anyone help me.
Manuel Petermann
Ranch Hand

Joined: Jul 19, 2011
Posts: 175

You need to define a controller class. Either by telling the classname in the fxml file or in the loader of your fxml file.
You might want to read fxml manual and fxml tutorial.
If you have any questions don't hesitate to ask.


Please correct my English.
naro pad
Ranch Hand

Joined: May 07, 2008
Posts: 58

I already created my controller class. My problem is how to bind the controls to the object properties.
Manuel Petermann
Ranch Hand

Joined: Jul 19, 2011
Posts: 175

You could add an onAction="#onTextChanged" to your TextFields like this:

and implement those in your controller like:

or you could add the controlls to your controller and add the listener afterwards like:


remember that the field name and the id always needs to be the same.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Form get input data
 
Similar Threads
javafx 2, layoutx / layouty values
JSlider issue
Embedding encoded image in .FXML file
How does JavaFX relate in the WorkPlace.
HBox, ChoiceBox and tab-order weirdness