title: JComponent and Left Align of components
body: <p>With the following code, I want to create a Jpanel generic component and add two sub components, a Label and a JTextField.  I am to add the components, but they do not left align.</p>
  
  <p>(No, I don't need GridBagLayout, but I was trying to do a basic example with GridBag.  Can you describe how to do this with GridBag and not another layout).</p>
  
  <pre><code>public Component buildStatusComponent() {
  
      // Place the components on one line //
      final GridBagLayout layout = new GridBagLayout(); 
      final GridBagConstraints constraints = new GridBagConstraints();              
      final JPanel group = new JPanel(layout);
  
      constraints.anchor = GridBagConstraints.WEST;
      constraints.gridx = 0;        
      constraints.fill = GridBagConstraints.NONE;
      group.setAlignmentX(JComponent.LEFT_ALIGNMENT);
      group.add(new JLabel("Messages: "), constraints);
  
      constraints.gridx = 1;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      group.add(this.statusArea, constraints);        
  
      return group;
  }
  </code></pre>
  
  <p>Above this level, I am just adding the JPanel and filling horizontally.</p>
  
  <pre><code>constraints.gridy++;
  constraints.fill = GridBagConstraints.HORIZONTAL;
  this.add(this.buildStatusComponent(), constraints);
  </code></pre>