title: JavaFX set color or icon in tablecolumn cell if
body: <p>I am still fairly new to java programming and struggle with understanding some concepts - especially setting a <code>TableColumn</code> cell value. (If anyone can explain this in layman's terms, that'd be awesome!)</p>
  
  <p>Here is my question... </p>
  
  <p>I have a tableview that I load with an <code>ObservableList</code> coming from my data table in a derby database. The for loop that adds the data to the table is something I learned from looking online and it definitely worked for me. I want to take it a step further so here is my challenge...</p>
  
  <p>The <code>ObservalbleList</code> will have something like example: line 1[toy, high, etc.] line 2 [box, medium, etc] etc.. Now, I want the code to look at this list to see if in that line - get the 1st value and if that equals high, medium or low then add a color icon in the status column that I will assign (or color fill if icon is too much work) <a href="https://i.stack.imgur.com/wQprv.png" rel="nofollow noreferrer">Example</a>. This is my code and it would probably make sense if that color icon piece would be in a for loop as well. This whole feature I am trying to achieve is the same as conditional formatting in excel. </p>
  
  <pre><code>data = FXCollections.observableArrayList();
  
  while (rs.next()) {
  
      ObservableList&lt;String&gt; row = FXCollections.observableArrayList();
  
      for(int i=1 ; i&lt;=rs.getMetaData().getColumnCount(); i++) {
          row.add(rs.getString(i));              
      }
  
      data.add(row);
      data.add(row);
  
      if (data.get(2).equals("High")) { 
          //***set cell icon red or color fill red with padding around***   
      }             
  }
  
  mtable.setItems(data);
  </code></pre>
  
  <p>Any help is appreciated! thank you! </p>