1

I have a form made with fxml, it has like 20 fields. (I.e. Person) and I have my controller with the 20 fields (one for every field) o want to know if there is a way to box all these fields in a unique bean like PersonBean. Actually I have to set all the fields to the bean manually in the initialize method.

Something like in the Id of the fxml input put something like "person.name".

dragonalvaro
  • 703
  • 1
  • 10
  • 28
  • Take a look at [FXForm2 - Automatic form generation and binding to bean properties](http://dooapp.github.io/FXForm2/), or see the [ControlsFX PropertySheet](http://controlsfx.bitbucket.org/org/controlsfx/control/PropertySheet.html). – jewelsea Jan 22 '15 at 18:47

1 Answers1

0

Not 100% sure but try something like:

text="${controller.person.name}"

where person is a property of the controller and name is a property of PersonBean.

See:

You might need to provide JavaFX properties such as

ObjectProperty<PersonBean> personProperty();
StringProperty nameProperty();

but maybe there is also some support for plain JavaBeans properties.

Community
  • 1
  • 1
Puce
  • 37,247
  • 13
  • 80
  • 152