title: Java FlowLayout - Margin/padding of specific elements?
body: <p>I am very new to Swing, and I'm trying to make a GUI.
  Using Netbeans' GUI creator thing, I managed to make something I liked. But it makes me feel bad that I used the editor for this, so now I am trying to make the same design using code.
  Here is a picture of what I am trying to make:
  <img src="https://i.stack.imgur.com/dxjky.png" alt="what I want to make">
  Right now I am just focusing on creating the "Criteria" section (yes I know I spelled it wrong in the picture)
  Here is what I currently have so far:
  <img src="https://i.stack.imgur.com/F2Uyj.png" alt="what I currently have">
  I've highlighted in red where I want to increase the margin:</p>
  
  <ul>
  <li>Between the right of the text boxes and left of the labels</li>
  <li>Between the top of the Criteria panel and the JFrame</li>
  <li>Between the left and right sides of the panel and the JFrame</li>
  </ul>
  
  <p>I come from web development where increasing the margins is what I want to do. If this is incorrect terminology, please inform me.
  Here is the code I am currently using:</p>
  
  <pre><code>public class Criteria extends JPanel {
      JLabel JobLabel = new JLabel();
      JLabel BoxLabel = new JLabel();
      JLabel PartLabel = new JLabel();
      JTextField JobInput = new JTextField();
      JTextField BoxInput = new JTextField();
      JTextField PartInput = new JTextField();
  
      public Criteria() {
          setLayout(new FlowLayout(FlowLayout.LEADING));
          setBorder(BorderFactory.createTitledBorder("Criteria"));
          JobLabel.setText("Job");
          JobLabel.setLabelFor(JobInput);
          BoxLabel.setText("Box");
          BoxLabel.setLabelFor(BoxInput);
          PartLabel.setText("Part");
          PartLabel.setLabelFor(PartInput);
          JobInput.setColumns(8);
          BoxInput.setColumns(8);
          PartInput.setColumns(8);
          add(JobLabel);
          add(JobInput);
          add(BoxLabel);
          add(BoxInput);
          add(PartLabel);
          add(PartInput);
      }
  }
  </code></pre>
  
  <p>I don't know how I would add margin to these components, so help would be very much appreciated. If I cannot achieve this effect with FlowLayout, then please tell me what I should use instead.</p>