title: Other placement of fields everytime i run the code
body: <p>I'm stuck with my application. Every time I run my code, my fields e.g. <code>fromTextField</code> once have width 180 other time my width <code>private static final Integer widthField = 232</code>.</p>
  
  <hr>
  
  <p>Code:</p>
  
  <hr>
  
  <pre><code>package gui;
  
  import javax.swing.*;
  import java.awt.*;
  
  public class MailGui extends JFrame {
      private static final Integer widthField = 232;
  
  private MailGui() {
          JPanel northPanel = new JPanel();
          northPanel.setLayout(new GridLayout(5, 5));
  
          JLabel fromLabel = new JLabel("From: ", SwingConstants.LEFT);
          JLabel passwdLabel = new JLabel("Password: ", SwingConstants.LEFT);
          JLabel toLabel = new JLabel("To: ", SwingConstants.LEFT);
          JLabel subjectLabel = new JLabel("Subject: ", SwingConstants.LEFT);
          JLabel textLabel = new JLabel("Content: ", SwingConstants.LEFT);
  
          JTextField fromTextField = new JTextField();
  
          JTextField toTextField = new JTextField();
          JPasswordField passwdPasswordField = new JPasswordField();
          JTextField subjectTextField = new JTextField();
          JTextArea textArea = new JTextArea(8, 30);
  
          JButton sendButton = new JButton("Send");
  
          textArea.setLineWrap(true);
  
          northPanel.add(fromLabel);
          northPanel.add(fromTextField);
  
          northPanel.add(passwdLabel);
          northPanel.add(passwdPasswordField);
  
          northPanel.add(toLabel);
          northPanel.add(toTextField);
  
          northPanel.add(subjectLabel);
          northPanel.add(subjectTextField);
  
          northPanel.add(textLabel);
          northPanel.add(textArea);
  
          this.add(northPanel, BorderLayout.NORTH);
  
          JScrollPane scrollPane = new JScrollPane(textArea);
          this.add(scrollPane, BorderLayout.CENTER);
  
          JPanel southPanel = new JPanel();
          southPanel.add(sendButton);
  
          add(southPanel, BorderLayout.SOUTH);
  
          this.pack();
  
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
          this.setVisible(true);
          this.setResizable(false);
  
  
          fromTextField.setBounds(textArea.getX() + 100, 0, widthField, 19);
          passwdPasswordField.setBounds(textArea.getX() + 100, 19, widthField, 19);
          toTextField.setBounds(textArea.getX() + 100, 38, widthField, 19);
          subjectTextField.setBounds(textArea.getX() + 100, 57, widthField,         19);
  
      }
  
      public static void main(String[] args) {
          new MailGui();
      }
  }
  </code></pre>
  
  <hr>
  
  <p>What I have:</p>
  
  <hr>
  
  <p><a href="https://i.stack.imgur.com/BfpSP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BfpSP.png" alt="First"></a></p>
  
  <hr>
  
  <p>Or</p>
  
  <hr>
  
  <p><a href="https://i.stack.imgur.com/lgazG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lgazG.png" alt="Second"></a></p>
  
  <hr>
  
  <p>What I except:</p>
  
  <hr>
  
  <p><a href="https://i.stack.imgur.com/lgazG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lgazG.png" alt="Second"></a></p>
  
  <hr>
  
  <p>Thanks for every help. Q.</p>