title: Resizable Swing layout with buttons arranged according to variable dimensions
body: <p>I would like to make a layout using Java Swing which looks like the following drawing.</p>
  
  <p><a href="https://i.stack.imgur.com/u98vY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u98vY.png" alt="layout sketch"></a><br>
  <sub>(source: <a href="http://tobias.braun-abstatt.de/files/forums/buttons_sketch.png" rel="nofollow noreferrer">braun-abstatt.de</a>)</sub>  </p>
  
  <p>On the left is a JPanel which is drawn through <code>paintComponent()</code> in a way that the graphics automatically scale when the window is resized. (The question isn't about that panel. That one's already done.)</p>
  
  <p>Now I need some buttons (the black boxes, added in Photoshop for the drawing) to the right of the JPanel mentioned before. The height of the reddish areas at the top and bottom, next to which there should be just empty space, is calculated along the lines of <code>CONSTANT_FACTOR * getHeight()</code>. Next to each compartment on the left, there should be a group of buttons, lined up to the center of the respective compartment (see the blue lines).</p>
  
  <p>The JPanel containing the buttons knows about the CONSTANT_FACTOR and the number of compartments, so it should be possible to feed this information into a layout manager.</p>
  
  <p>Which layout manager would I best use to achieve this layout? I've read about all the different layout managers, but I can't quite figure out which one or which combination of them best fits in this case.</p>