• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Form get input data

 
Ranch Hand
Posts: 58
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 177
Hibernate Python Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
naro pad
Ranch Hand
Posts: 58
Netbeans IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I already created my controller class. My problem is how to bind the controls to the object properties.
 
Manuel Petermann
Ranch Hand
Posts: 177
Hibernate Python Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic