title: How to limit javafx TableView Size to the Size necessary?
body: <p>I am programming a simple Questionare Application. I am using a TableView inside a custom javaFX component (representing one question), that is used as a ListCell inside a ListView (used to represent the entire questionaire).</p>
  
  <p>What I want: Each ListCell uses as little space as possible (or necessary) while still desplaying its full content. </p>
  
  <p>What happens: The TableView seems to default to a standard size. If the Table has more content, it displays its content within a ScrollPane. If the TableView has less content, it fills itself with empty space.</p>
  
  <hr>
  
  <p>I tried to solve my problem in a number of ways:</p>
  
  <ol>
  <li><p>Originally I assumed that there must be a way deactivate the scroll bars. But I couldn't find any way to do that.</p></li>
  <li><p>Then I tried to change the size of the table by changing the PreferredSizeProperty: 
  <code>
  table.setPrefHeight()
  </code>
  But I can't find any information on how big the table is.
  <code>
  table.setPrefHeight(USE_COMPUTED_SIZE);
  </code> 
  did not have the result I was hoping for.</p></li>
  <li><p>Then I tried to compute the necessary height myself, but I couldn't find any way to determine the height of the individual rows. Calling <code>this.getTableRow().getHeight()</code> within the update method of the custom TableCell would result in NullPointerExceptions. When checked against null, it would still return 0!
  <code>
   TableRow&lt;T&gt; tr = this.getTableRow();
   if (tr != null) {
       System.out.println(tr.getHeight());
   }
  </code></p></li>
  <li><p>Quite frustrated, I decided to fix the row height, by calling 
  <code>
  table.setFixedCellSize(20);
  </code>
  This severly limits the point of custom TableCells, but I wasn't making any progress otherwise. However, the table height is also not equal to the number of lines multiplied by a fixed row height, because the table header needs to be taken into account. And I couldn't access the table header or ask for the table headers size / height.</p></li>
  </ol>
  
  <p>Do you have any suggestions where I went wrong or what I have overlooked to achieve my original goal (Having a ListCell that is preciesly as big a as necessary to display every line of the table, but not a single empty line?) Any help / ideas would be most welcome! Thank you!</p>