title: JavaFX layout that scales with parent
body: <p>I'm using JavaFX in a project instead of Swing because of the enhanced multimedia, webviewer and possibility to use visual effects. However, what I've learned from what I found on the web (<a href="http://docs.oracle.com/javafx/2/layout/jfxpub-layout.htm" rel="nofollow noreferrer">http://docs.oracle.com/javafx/2/layout/jfxpub-layout.htm</a> and others) is that <strong>JavaFX</strong> layout managers <strong>focus on scaling the size of the parent based on the size of the content</strong>, whereas <strong>Swing</strong> focusses on <strong>scaling the content according to the parent</strong>, at least based on the <code>Layout</code> being used.</p>
  
  <p>Right now I'm using an <code>Accordion</code> with some <code>TitledPane</code> children. One of them contains a <code>GridPane</code> for the simple reason it is the best way I know to emulate a <code>GridLayout</code> (as I learned from my previous question here: <a href="https://stackoverflow.com/questions/18697347/javafx-layout-equivalent-to-gridlayout">JavaFX layout equivalent to GridLayout</a>). I want to have the <code>TitledPane</code>'s content split in 2 rows and 1 column, each row with a 50% height of the available space in the <code>TitledPane</code> (scaling with the <code>Stage</code> or <code>Scene</code>), equivalent to what a <code>GridLayout(2,1)</code> inside a <code>BorderLayout.CENTER</code> would accomplish. For this, I've added a <code>GridPane</code> with 2 <code>RowConstraint</code>s using <code>setPercentHeight(50)</code> and 1 <code>ColumnConstraint</code> with <code>setPercentWidth(100)</code>. However, I've noticed the contents are scaling with the grid properly, but the grid is not taking up all available space in the <code>TitledPane</code> (because apparently it doesn't act like a <code>BorderPane</code>'s center). I've also tried with <code>setMaxWidth</code> to make the content scale with the parent, but it doesn't seem to work either (as said here: <a href="https://stackoverflow.com/questions/9816099/javafx-how-to-make-my-custom-component-use-all-available-space-from-parent-layo">JavaFX: How to make my custom component use all available space from parent layout?</a>). And even if it would, do I need to set the max width to EACH descendent in my UI elements tree to have all of them scale?</p>
  
  <p>Either way, does anyone know how to make a <code>TitledPane</code> with 2 equal spaces in it underneath eachother that scale with the titledpane's size?</p>
  
  <p><img src="https://i.stack.imgur.com/FCyU5.png" alt="column width does not take up all available space"></p>