Как нарисовать несколько прямоугольников

поэтому я пытаюсь создать простую программу, в которой вы нажимаете на экран, и она создает блок, который падает и сталкивается с большим блоком внизу и прилипает к нему. Вроде как простая программа столкновений. Проблема в том, что когда я создаю один блок, он удаляет блок ранее. Я сделал массив, но он все еще делает это. Кто-нибудь из вас знает, что я делаю неправильно? Я уверен, что это просто исправить.

    public class Screen extends JPanel implements Runnable {

public static JLabel statusbar; //displays a status bar showing what mouse movements are taking place
private Image cat;  //image of the cat
public int xCoord ; //get the coordinates of the mouse pressed
public int yCoord ;
public int xCreate;
public int yCreate;
public Rectangle Ground;
public Rectangle Block;
public boolean isClicked = false;
public int clickCount = 0;
Rectangle blocks[] = new Rectangle[10];

int blocknum = 0;

    public Screen(Frame frame) {
            loadPic(); //calls the loadPic method above 
                Handlerclass handler = new Handlerclass(); //creates a new class to use the mouse motion listener
                    System.out.println("mouse works!");
         addMouseListener(handler);
         addMouseMotionListener(handler);
         statusbar = new JLabel("default");
            add(statusbar);
    }
    public void run(){ //this is the game run loop
        System.out.println("this is running");   
        try{
        } catch(Exception e) {} //exception handling

    }
    public void loadPic(){ //loads the picture from the other project but its the same pic
        cat = new ImageIcon("C:\\Users\\Camtronius\\Documents\\NetBeansProjects\\Moving Block Proj\\src\\MovingBlock\\catIcon1.png").getImage(); //gets the image
        System.out.println("Image Loaded!");
    }

     @Override public void paintComponent(Graphics g){
        super.paintComponent(g); //paints the component, the picture, on top
            Graphics2D g2d = (Graphics2D) g.create();

             g2d.drawImage(cat, xCoord, yCoord, null);      

             g2d.setColor(Color.BLUE);
             Ground = new Rectangle(0,450,550,50);
             g2d.fillRect(0,450, 550, 50);

                 for(Rectangle blocknum : blocks){
                  if (blocks != null) {    
                      g2d.setColor(Color.RED);
                       g2d.fillRect(xCreate,yCreate,50,50); 
                       System.out.println(blocknum);
                  }

                 }
                 //move();           
    }

   public void move(){   
    if(yCreate

Ответы на вопрос(1)

Ваш ответ на вопрос