1

My question is very simple but I don't find the answer.

I would to create a form in JavaFX with fxml file which browses a list of TextField.

This list is filed in Java but how can I browse this list in fxml ?

Is it possible to do something like this:

<LOOP >
<HBox>
    <children>
        <Label prefWidth="150" text="Title" />
    <TextField fx:id="title" />
    </children>
</HBox>
</END LOOP>

Thanks for your help

Kiva
  • 9,193
  • 17
  • 62
  • 94

2 Answers2

2

If you specifically make a custom component with an itemrenderer/factory pattern, you can achieve this in FXML, still you'll have to program it. Columns in TableView are made like that so you can look at the sources to see if you can do something similar (of course, it'll take some time and it is not trivial).

The easy and lazy way is to define a container in FXML with an id, implementing Initializable in the controller, inject the container in your controller and in the initialize() method dynamically adding children in java in the container.

zenbeni
  • 7,019
  • 3
  • 29
  • 60
-1

No it is not possible in fxml. You may use JavaFX Scene Builder 1.0 provided by oracle. It is a smart tool provide you an Interface like Visual Studio(Drag and Drop).

Jitendra Pareek
  • 627
  • 7
  • 28