title: JavaFX Table: Label not behaving as expected
body: <p>I'm using the following code to highlight text in a <code>Table</code> with <code>HBoxes</code> containing multiple <code>Labels</code>. But some <code>Labels</code> display ellipses instead of text. How can i force the <code>Labels</code> to appear in full width?</p>
  
  <pre><code>    col3.setCellValueFactory(new PropertyValueFactory&lt;RegexMatch, String&gt;("excerptLineTable"));
      col3.setCellFactory(new Callback&lt;TableColumn, TableCell&gt;() {
          @Override
          public TableCell call(TableColumn param) {
              TableCell cell = new TableCell() {
                  @Override
                  protected void updateItem(Object text, boolean empty) {
                      if (text != null &amp;&amp; text instanceof String) {
                          HBox hbox = new HBox();
                          hbox.setAlignment(Pos.CENTER_LEFT);
                          String str = (String) text;
                          if (txtSearchField.getText().length() &gt; 3 &amp;&amp; str.contains(HIGHLIGHT_START)) {
                              // Something to highlight
                              hbox.getChildren().clear();
                              while (str.contains(HIGHLIGHT_START)) {
                                  // First part
                                  Label label = new Label(str.substring(0, str.indexOf(HIGHLIGHT_START)));
                                  label.setWrapText(false);
                                  label.setMaxWidth(Double.MAX_VALUE);
                                  hbox.getChildren().add(label);
                                  str = str.substring(str.indexOf(HIGHLIGHT_START) + HIGHLIGHT_START.length(), str.length());
                                  // Part to highlight
                                  Label label2 = new Label(str.substring(0, str.indexOf(HIGHLIGHT_END)));
                                  label2.setWrapText(false);
                                  label2.setMaxWidth(Double.MAX_VALUE);
                                  label2.setStyle("-fx-background-color: "+ HIGHLIGHT_COLOR+";");
                                  hbox.getChildren().add(label2);
                                  // Last part
                                  str = str.substring(str.indexOf(HIGHLIGHT_END) + HIGHLIGHT_END.length(), str.length());
                                  if (!str.contains(HIGHLIGHT_START)) {
                                      Label label3 = new Label(str);
                                      label3.setWrapText(false);
                                      label3.setMaxWidth(Double.MAX_VALUE);
                                      hbox.getChildren().add(label3);
                                  }
                              }
                          } else if (txtSearchField.getText().length() &lt; 1) {
                              // Remove former highlightings and show simple text
                              str = str.replaceAll(HIGHLIGHT_START, "");
                              str = str.replaceAll(HIGHLIGHT_END, "");
                              hbox.getChildren().clear();
                              Label label = new Label(str);
                              label.setWrapText(false);
                              label.setMaxWidth(Double.MAX_VALUE);
                              hbox.getChildren().add(label);
                          } else {
                              // show simple text
                              hbox.getChildren().clear();
                              Label label = new Label(str);
                              label.setWrapText(false);
                              label.setMaxWidth(Double.MAX_VALUE);
                              hbox.getChildren().add(label);
                          }
                          setGraphic(hbox);
                      }
                  }
              };
              return cell;
          }
      });
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/4PB7X.png" alt="enter image description here"></p>
  
  <p><strong>Solution</strong><br>
  Using <code>Labels</code> in a <code>HBox</code> with different background colors for each <code>TableView</code> works fine. My problem was a bug in my highlighting search and replace method.</p>