title: How to paint on a Jpanel?
body: <p>i am trying to add 2 different panels in a Frame. one panel adds few buttons in the frame. others frame will add a chess board into the frame. i am confused, how to draw this board on a panel. my Frame will have a board on the top and buttons at the bottom. Moreover, let me know if i am somewhere wrong in the given code can anybody help me? my Code is</p>
  
  <pre><code>import java.awt.BorderLayout;
  import java.awt.Color;
  import java.awt.FlowLayout;
  import java.awt.GridLayout;
  import java.awt.event.MouseEvent;
  import java.awt.event.MouseListener;
  import javax.swing.JButton;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  
  public class Test {
  
      private JFrame main;
      private JPanel board;
      private JPanel buttons;
      private JButton add;
      private JButton delete;
  
      public Test()
      {
          main=new JFrame();
          board=new JPanel();
          buttons=new JPanel();
          add=new JButton("Add");
          delete=new JButton("Delete");
          init();
          addButtons();
      }
      public void init()
      {
          main.setSize(700,700);
          main.setVisible(true);
          main.setDefaultCloseOperation(main.EXIT_ON_CLOSE);
      }
      public void addButtons()
      {
          buttons.setSize(700,40);
          buttons.setLayout(new FlowLayout());
          buttons.add(add);
          buttons.add(delete);
          main.add(buttons,BorderLayout.SOUTH);
  
      }
      public void addBoxes()
      {
          // what should be my code here...??
      }
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          new Test();
  
      }
  }
  </code></pre>