Make rectangle have JButton or ImageIcon
<p>I am trying to create code for brick for gamebreaker in java and  I am struggling trying to find a way to convert the rectangles I created to become JButtons or Image Icons so I can use the methods from the JComponent class. I know this does not match any of the constructors for a JButton or ImageIcon, but I was wondering if anyone has any suggestions of what i can do</p>

<pre><code>import javax.swing.JButton;

import java.awt.Rectangle;

public class Bricks {

    private static int width=2;
    private static int height=2;
    public static int area;
    public static int Brick_Length=4;
    public static int Brick_Height=9;
    public static JButton[] brickNum;

    public Bricks(int x, int y,int width, int height)
    {
        int horizontal;
        int vertical;
            this.width=width;
            this.height=height;
            horizontal=x;
            vertical=y;

            Rectangle brick = new Rectangle(horizontal,vertical,this.width,this.height);

    }

public static void GenerateBrick()
{
        int counter=0;

        for(int row = 0; row &lt; Brick_Length; row++){
            for( int col = 0; col &lt; Brick_Height; col++){

                 brickNum[counter] = new JButton( new Rectangle (row,col,width,height)); // this is now a componenet or a button or at least it should be

                }
            }

}


public static int getArea()
{
    area = width * height;
return area;
}


}
</code></pre>
