title: FXML template or a way to generate placeholders in javafx
body: <p>I am making a GUI in Java where I am getting the data I need through SPARQL-queries. The program is about exercises, and I would like to make a container (hbox/vbox) for each exercise with relevant information. The problem is that right now, the program looks really ugly, because I am generating the hbox with pure javafx with the code below: </p>
  
  <pre><code>ResultSet result = Querying.ontologyQuery(Strings.getFeatured());
      List&lt;Resource&gt; exerciseList = new ArrayList&lt;&gt;();
      List&lt;Resource&gt; mainMuscleList = new ArrayList&lt;&gt;();
      List&lt;Literal&gt; equipmentList = new ArrayList&lt;&gt;();
      while (result.hasNext()) {
          QuerySolution qs = result.next();
          Resource exercise = qs.getResource("Exercise");
          Resource mainMuscle = qs.getResource("mainMuscle");
          Literal equipment = qs.getLiteral("Equipment");
          exerciseList.add(exercise);
          mainMuscleList.add(mainMuscle);
          equipmentList.add(equipment);
      }
  
      for (int i = 0; i &lt; 4; i++) {
          HBox hbox = addHbox();
          vbox.getChildren().add(hbox);
          Label exercise = new Label();
          Label mainMuscle = new Label();
          Label equipment = new Label();
  
          mainMuscle.setText(mainMuscleList.get(i).getLocalName());
          equipment.setText(equipmentList.get(i).getString());
          exercise.setText(exerciseList.get(i).getLocalName());
  
          hbox.getChildren().add(exercise);
          hbox.getChildren().add(mainMuscle);
          hbox.getChildren().add(equipment);
  </code></pre>
  
  <p>I guess what I am asking, is it if it's possible to make a template sort of in fxml, and just deploy the information from the SPARQL-queries into the placeholders in the "template". Any help is appriciated on how to go about this</p>