title: How do I left align a JLabel inside a JPanel?
body: <p>I am trying to build a status bar for my login dialog box but the label doesn't align to the left of the status panel. Here is my code.</p>
  
  <pre><code>public class LoginDialog extends JDialog {
  
      private static final long serialVersionUID = 1L;
  
      protected JLabel lblTopSpace = null;
      protected JPanel loginPanel = null;
      protected JPanel statusPanel = null;
  
      public LoginDialog(String title) {
  
          super((Dialog)null);
  
          this.setTitle(title);
  
          Initialize();
      }
  
      protected void Initialize() {
  
          lblTopSpace = new JLabel("Login into Bookyard");
          lblTopSpace.setForeground(this.getBackground());
  
          loginPanel = new LoginPanel();
          statusPanel = new JPanel();
  
          statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
          statusPanel.setSize(this.getWidth(), 50);
  
          JLabel lblStatus = new JLabel("Status");
          lblStatus.setFont(new Font("Verdana", Font.PLAIN, 12));
          lblStatus.setHorizontalAlignment(SwingConstants.LEFT);
          statusPanel.add(lblStatus);
  
          this.setLayout(new BorderLayout());
          Container container = this.getContentPane();
  
          container.add(lblTopSpace, BorderLayout.NORTH);
          container.add(loginPanel, BorderLayout.CENTER);
          container.add(statusPanel, BorderLayout.SOUTH);
  
          this.pack();
      }
  }
  </code></pre>
  
  <p>Here is what it looks like presently.</p>
  
  <p><a href="https://i.stack.imgur.com/oJyl4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJyl4.png" alt="enter image description here"></a></p>
  
  <p>What am I missing?</p>