title: How to set border on jPanel?
body: <p>My projects constists of two classes, GoBoard extends JPanel.</p>
  
  <p><strong>GoTest.java:</strong></p>
  
  <pre><code>import javax.swing.*;
  import java.awt.Graphics;
  import java.io.*;
  import java.awt.*;
  
  import javax.swing.border.Border;
  import javax.swing.border.LineBorder;
  
  class GoTest{
      private static void initGui(){
          JFrame frame = new JFrame("GoBoard");
          GoBoard jboard = new GoBoard();
          jboard.setLayout(new BorderLayout(10,10));
          jboard.setBorder(BorderFactory.createEmptyBorder(0,10,10,10)); 
          frame.add(jboard);
  
  
  
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(400, 400);
          frame.pack();
          frame.setVisible(true);
      }
  
      public static void main(String[] args){
          javax.swing.SwingUtilities.invokeLater(new Runnable(){
              public void run(){
                  initGui();
              }
          });
      }
  }
  </code></pre>
  
  <p><strong>GoBoard.java:</strong></p>
  
  <pre><code>import javax.swing.*;
  import java.awt.Graphics;
  import javax.swing.border.Border;
  class GoBoard extends JPanel{
      private int linien;
  
      public GoBoard(){
          this(9);    
      }
  
      public GoBoard(int pLinien){
          this.linien = pLinien;
          this.setBorder(BorderFactory.createEmptyBorder(0,10,10,10)); 
      }
  
      public void paintComponent(Graphics g){
          super.paintComponent(g);
          int d = 0;
          int h = 0;
          for(int i = 0; i &lt; this.linien; i++){
              g.drawLine(0,h, getWidth(), h);
              g.drawLine(d,0,d,getHeight());
              h += getHeight()/this.linien;
              d +=getWidth()/this.linien;
          }
      }
  }
  </code></pre>
  
  <p>I want to set a border to have padding according to the frame where I display the panel.
  However I get no border. Any idea?</p>