title: How to give spaces between jlabel?
body: <p>Hi i am trying to make java desktop application where i am using multiple jlabel i want to give little spaces between every label </p>
  
  <p>how can i achieve this</p>
  
  <p>here is my code</p>
  
  <pre><code>public class Second extends javax.swing.JFrame {
  JLabel label=new JLabel();
      /**
       * Creates new form Second
       */
      public Second() {
            this.getContentPane().setBackground(new java.awt.Color(255, 140, 0));
  this.setExtendedState(JFrame.MAXIMIZED_BOTH);
  this.setUndecorated(true);
  JButton print= new JButton();
  print.setBackground(new java.awt.Color(153, 153, 0));
              print.setOpaque(true);
              print.setBounds(525,1282,130,85);
              print.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
            print.setForeground(new java.awt.Color(255,255,255));
              print.setText("Print");
              this.add(print);
  
            JButton home= new JButton();
  home.setBackground(new java.awt.Color(153, 153, 0));
              home.setOpaque(true);
              home.setBounds(640,1282,130,85);
              home.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
            home.setForeground(new java.awt.Color(255, 255,255 ));
              home.setText("Home");
              this.add(home);
  
  int Height = 134;
  int a=100;
               ArrayList&lt;JLabel&gt; label = new ArrayList&lt;JLabel&gt;();
  
    for(int i=0;i&lt;23;i++){
           JLabel j = new JLabel();
             j.setBackground(new java.awt.Color(255, 140, 255));
              j.setOpaque(true);
              j.setBounds(5,Height,378,50);
              j.setFont(new java.awt.Font("Times New Roman", 1, 16)); // NOI18N
            j.setForeground(new java.awt.Color(128, 128, 128));
              j.setText("Case                                  Item                         CourtNo   ");
               LineBorder line = new LineBorder(Color.blue, 2, true);
  
         j.setBorder(line);
              this.add(j);
              label.add(j);
  
  
                 JLabel j1 = new JLabel();
              j1.setBackground(new java.awt.Color(255, 140, 0));
              j1.setOpaque(true);
              j1.setBounds(390,Height,768,50);
              j1.setFont(new java.awt.Font("Times New Roman", 1, 16)); // NOI18N
              j1.setForeground(new java.awt.Color(128, 128, 128));
              j1.setText("Case                                 Item                         CourtNo   ");
              this.add(j1);
              label.add(j1);
  
  
                 Height = Height +50;
                 a=a+10;
    }
  
  
  
  
          initComponents();
  
  
      }
    public void paint(Graphics g) {
          super.paint(g);
  
           Graphics2D g3 = (Graphics2D) g;
        BasicStroke bs = new BasicStroke(2);
      Line2D lin1 = new Line2D.Float(386, 100, 386, 1282);
        Line2D lin = new Line2D.Float(0, 1283, 768, 1283);
        Line2D line3=new Line2D.Float(400,1284,400,1364);
      g3.setStroke(bs);
       g3.setColor(Color.white);
       g3.draw(lin1);
       g3.draw(lin);
       g3.draw(line3);;
  
    }
  public static void main(String args[]) {
  java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new Second().setVisible(true);
              }
          });
      }}
  </code></pre>
  
  <p>My new code</p>
  
  <pre><code>public class Testing1 extends javax.swing.JFrame {
  
  
      public Testing1() {
  
               JFrame frame = new JFrame();
          JPanel panel = createPanel();
          panel.setLocation(100, 100);
          //panel.setLayout(null);
          this.add(panel);
          this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          this.pack();
          this.setLocationRelativeTo(null);
          this.setVisible(true);
  
          initComponents();
      }
  
  
       private JPanel createPanel() {
      jPanel1 = new JPanel(new GridLayout(0, 1, 10, 5));
          EmptyBorder panelBorder = new EmptyBorder(10, 10, 10, 10);
          jPanel1.setBorder(panelBorder);
          EmptyBorder border = new EmptyBorder(5, 20, 5, 20);
          LineBorder line = new LineBorder(Color.blue, 2, true);
          CompoundBorder compound = new CompoundBorder(line, border);
          for (int i = 0; i &lt;12; i++) {
              JLabel label = new JLabel("Label" + i);
              label.setBorder(compound);
             // label.setBounds(13, 100, 100, 50);
             jPanel1.add(label);
          }
          return jPanel1;
      }
  
  
  
      @SuppressWarnings("unchecked")
      // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt;                          
      private void initComponents() {
  
          jPanel1 = new javax.swing.JPanel();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  
          jPanel1.setBackground(new java.awt.Color(204, 0, 153));
  
          javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
          jPanel1.setLayout(jPanel1Layout);
          jPanel1Layout.setHorizontalGroup(
              jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGap(0, 306, Short.MAX_VALUE)
          );
          jPanel1Layout.setVerticalGroup(
              jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGap(0, 243, Short.MAX_VALUE)
          );
  
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
          getContentPane().setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addGap(0, 94, Short.MAX_VALUE))
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addGap(46, 46, 46)
                  .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                  .addContainerGap())
          );
  
          pack();
      }                      
  
  
      public static void main(String args[]) {
  
  
          /* Create and display the form */
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new Testing1().setVisible(true);
              }
          });
      }
  
      // Variables declaration - do not modify                     
      private javax.swing.JPanel jPanel1;
      // End of variables declaration                   
  }
  </code></pre>
  
  <p>updated
  Thanks in advance</p>