title: How would I position a JComponent to true center in a BorderLayout?
body: <p>I am developing a Swing application using <code>BorderLayout</code> to position the components. Since <code>BorderLayout.CENTER</code> positions components to whatever is left after the other components are placed, and that fact is making my GUI look weird, I was wondering if there was a way to position components to <em>true</em> center, rather than in between the two sides. Since <code>BorderLayout</code> spaces make a component fill an entire space, I'm guessing the solution would be to wrap the component into a <code>JPanel</code>. However, positioning the component to the center of this panel will make the component be closer to one side than another if you have components on other sides. How do I work around this?</p>
  
  <p>These images demonstrate the problem and the ideal solution; the gray border represents the <code>BorderLayout.SOUTH</code> (wrapped in a <code>JPanel</code>) of the main frame. The black squares represents components that are throwing the center component off. The red square represents the component that needs to be centered.</p>
  
  <p>Problem:</p>
  
  <p><a href="https://i.stack.imgur.com/R4541.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R4541.png" alt="Problem representation"></a></p>
  
  <p>Ideal solution:</p>
  
  <p><a href="https://i.stack.imgur.com/6lxHi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6lxHi.png" alt="Solution representation"></a></p>