1

My main UI is defined in an FXML file and is supposed to contain a list of persons. A person would have a picture and some different lines of read-only text to display (name, age, etc...) The list itself will change all the time throughout runtime. (CRUD)

I know it would be possible to create a person-class and just add instances of it to a VBox/Hbox/... at runtime but I would like to create the definition of what the person should look like in an FXML file - if possible.

Is there a way to do this AND also fill these 'object-templates' with data (picture and texts) like with a normal template via the @FXML annotation?

Ray
  • 23
  • 3

1 Answers1

1

You may consider using SceneBuilder tool to create fxml files. With SceneBuilder, you can create custom FXML elements, and embed them to each other. Check these links out:

https://rterp.wordpress.com/2014/05/21/adding-custom-javafx-components-to-scene-builder-2-0/

Adding a custom component to SceneBuilder 2.0

Community
  • 1
  • 1
kornisb
  • 260
  • 1
  • 12