title: JavaFX cell styling
body: <p>I have looked at other questions, yet they do not satisfy my question</p>
  
  <p>I want specific cells to have red color in my treeview, and I use </p>
  
  <pre><code>public void updateView()
  {
      treeView.setCellFactory(tv -&gt; new TreeCell&lt;String&gt;() {
          @Override
          protected void updateItem(String item, boolean empty) {
              super.updateItem(item, empty);
              if (empty || item == null) {
              }
              else {
                  for(ArrayList&lt;TreeItem&gt; x :Signals)
                  {
                      for(TreeItem z: x)
                      {
                          if(z.getValue().equals(item))
                          {
                              setText(item);
                              setStyle("-fx-text-fill: red");
                          }
                          else{ setText(item);}
                      }
                  }
              }
          }
      });
  }
  </code></pre>
  
  <p>I tried formatting it, it just does not work for me, sorry.
  What happens is that is messes up my treeView table. See pictures: <a href="https://imgur.com/a/8tf76xn" rel="nofollow noreferrer">https://imgur.com/a/8tf76xn</a></p>
  
  <p>Any ideas why?</p>