HomeWork Help: populate images into Grids java

I need help with my homework,i have a class that draws grids on a jframe window. I need a method that will let me draw an image on a grid i choose using the index of a grid in the parent layout. Here is what my code draws so far on a window…Accessing a single grid element in the layout is all i want then from there, set i will add an image resource with JPanel object.. The icon i intend to draw on a single grid is this..

enter image description here
The code i used to achieve that is here

public class Grids extends Frame {
         * Construct a GfxDemo2 given its title, width and height. Uses a
         * GridBagLayout to make the Canvas resize properly.
         //this is the image resource in intend to fill in a single grid but i have
        String red_diamond="red-diamond.jpg";
        ImageIcon p = new ImageIcon(this.getClass().getResource(red_diamond));

        Grids(String title, int w, int h, int rows, int cols) {

            // Now create a Canvas and add it to the Frame.
            GridsCanvas xyz = new GridsCanvas(w, h, rows, cols);

            addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {

            // Normal end ... pack it up!

        public static void main(String() a) {

            Grids mygrids=new Grids("Grids",300,300,6,6);
            //method to fill the grid with the image defined in the class

class GridsCanvas extends Canvas {
    int width, height;

    int rows;

    int cols;

    GridsCanvas(int w, int h, int r, int c) {
        setSize(width = w, height = h);
        rows = r;
        cols = c;

    public void paint(Graphics g) {

        int i;
        width = getSize().width;
        height = getSize().height;

        // draw the rows
        int rowHt = height / (rows);
        for (i = 0; i < rows; i++)
            g.drawLine(0, i * rowHt, width, i * rowHt);

        // draw the columns
        int rowWid = width / (cols);
        for (i = 0; i < cols; i++)
            g.drawLine(i * rowWid, 0, i * rowWid, height);