1

Let's say I have a list of People. These people have a number of custom properties, first names, last names, addresses etc.

What I want to do is create a "custom component" (some text fields etc), written in FXML, which represents a person. Then, for each person in my collection (let's say an ObservableList), I want to append a container with this component.

Coming from Swing I can imagine how I would do this in swing programatically, but my hope is to do this in a way which best utilizes the features available of javafx.

I really appreciate any help, links to tutorials etc.

Cheers!

note: I should say that I'm aware I should be using javaFX collections to create observablelists, etc, and will do so. My question pertains specifically as to the best ways to generate UI's using FXML templates and data models.

jacheson
  • 1,303
  • 2
  • 12
  • 16
  • This is still kind of vague for me. What does your composite component look like? Can you mock it up in [SceneBuilder](http://www.oracle.com/technetwork/java/javafx/tools/index.html) and edit your question to include an image and FXML? – jewelsea Feb 22 '14 at 07:03
  • @jewelsea Hi. So here is a very basic outline of what I want to do. [Screenshot](http://imgur.com/f1W0HYk). Here's the FXML: http://pastie.org/8757801. The goal is to have a data model of people, in say a List of some type. How do I auto generate these "Person" components (Represented by the VBox which contains the 3 labels in this example) from a data model? If my list contains 3 people, how do I generate the UI elements for those 3 people given this "template". – jacheson Feb 22 '14 at 07:47
  • I would try writing a class that extends from Node or another existing GUI-element. You could either create a class for one element and put them together in a container or write a container class yourself that contains the aforementioned elements. The custom classes should either take a "Person" object or preferrably an ObservableList of "Persons". – Lukas Leitinger Feb 28 '14 at 08:54

0 Answers0