title: JavaFX: Laying out Nodes in a Row
body: <p>Given following layout:</p>
  
  <p><a href="https://i.stack.imgur.com/xfp4C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xfp4C.png" alt="enter image description here"></a></p>
  
  <p>In some cases <em>Field 2</em> (and the corresponding <code>Label</code>above) are invisible and <em>Field 3</em> and <em>Field 4</em> shall be moved left accordingly.</p>
  
  <p>My first attempt was to place the elements in a <code>Pane</code> (as I did as well for the screenshot in this example) and recalculate the exact positions of all elements if one is set invisible. This solution is working but it needs lot of maintenance if the element, their sizes or order changes.</p>
  
  <p>In the course of discussing another problem I got the idea to use a <code>HBox</code> to place the fields in it, which would give me auto-spacing.</p>
  
  <p>But using a <code>HBox</code> does not do the trick, because:</p>
  
  <ol>
  <li>As far as I see in a <code>HBox</code> the labels cannot be set above the elements.</li>
  <li>If I set an element invisible the other elements won't move left.</li>
  </ol>
  
  <p>Any ideas how to archive my desired behavior?</p>