title: How to align all jPanels within a jPanel to the left?
body: <p>Hey I'm attempting to align all panels within a panel to the left of the larger panel.</p>
  
  <p>here is a picture of what I'm currently faced with:</p>
  
  <p><img src="https://i.stack.imgur.com/b6Jdm.png" alt="Box panel layout">
  <br></p>
  
  <p>For the master panel (the one that contains all other panels - I shall call it the master!)
  I'm using the following code when creating it:</p>
  
  <pre><code>    JPanel panel = new JPanel();
      panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
  </code></pre>
  
  <p>For each of the panels within it I'm also using the BoxLayout, but I've tried things like [jpanel].setAlignmentX(Component.LEFT_ALIGNMENT) on each panel but that doesn't seem to work. </p>
  
  <p>Any help would be appreciated!</p>
  
  <p>:)</p>
  
  <p>edit: for the "Dimensions of box(m):" label, is there any way of aligning that to the top of the panel it's contained in?  It's in a panel of its own.</p>
  
  <p>edit:  Once fixed:</p>
  
  <p><img src="https://i.stack.imgur.com/ZBQRq.png" alt="JPanel problem once fixed"></p>
  
  <p>Solution below, thanks all for your help :)</p>