So my problem is as follows: I am creating a clone of tetris. In one of my classes I have a Jpanel which draws everything and has a paint method. 

```
public class Action extends JPanel { 
private final Color BACKGROUND_COLOR = Color.yellow; 

public Action() { 
    setBackground(BACKGROUND_COLOR); 
    setPreferredSize(new Dimension(100, 220)); 
    setVisible(true); 
    new Timer(1000, new TimerListener()).start(); 
}

@Override
protected void paintComponent(Graphics pen) { 
    super.paintComponent(pen); 
    pen.setColor(Color.gray); 
    GameMemory memory = new GameMemory(); 
    int[][] grid = memory.getGrid(); 
    for (int r = 0; r < grid.length; r++ ) 
        for (int c = 0; c < grid[c].length; c++) 
            if (grid[r][c] == 1) 
                pen.fillRect(c * 30, r * 30, 40, 40); 
} 

private class TimerListener implements ActionListener { 
    @Override
    public void actionPerformed(ActionEvent e) { 
        Action.this.repaint(); 
    } 
} 

} 

```

I was trying to make it repaint the every second. 

The other class is an array that holds in memory occupied cells marking them with status 1 if they are. 

```
/**
This class will contain a two-dimensional array that will 
keep in itself the figures, as well as checking if the raws are 
full. 

```

\*/ 

```
public class GameMemory { 
private final int AXIS_X = 6; //Where axis of the 
private final int AXIS_Y = 1; //figure will appear
private int curX = AXIS_X; 
private int curY = AXIS_Y; 
private final int[][] grid = new int[22][10]; 
FigureI figure = new FigureI(); 

GameMemory() {
    Timer timer = new Timer(1000, new TimerListener()); 
    timer.start(); 
}

public int[][] getGrid() { 
    return grid; 
}

private class TimerListener implements ActionListener { 
    @Override 
    public void actionPerformed(ActionEvent e) { 
        curY ++; 
        grid[curY + figure.block0[1]][curX + figure.block0[0]] = 1; 
        grid[curY + figure.block1[1]][curX + figure.block1[0]] = 1; 
        grid[curY + figure.block2[1]][curX + figure.block2[0]] = 1; 
        grid[curY + figure.block3[1]][curX + figure.block3[0]] = 1; 
        System.out.println(Arrays.deepToString(grid)); // To debug.
    } 
} 

```

And the third file simply contains figure coordinates. 

```
  /**
    This file contains all the figures. 
    */ 

class FigureI { 

int[] block1 = { 0, -1 }; 
int[] block0 = { 0, 0 }; 
int[] block2 = { 0, 1 }; 
int[] block3 = { 0, 2 }; 

}

    class FigureJ { 
    int[] block1 = { 1, 0 }; 
    int[] block0 = { 0, 0 }; 
    int[] block2 = { -1, 0 }; 
    int[] block3 = { -1, -1 }; 
}

class FigureL { 
    int[] block1 = { -1, 0 }; 
    int[] block0 = { 0, 0 }; 
    int[] block2 = { 1, 0 }; 
    int[] block3 = { 1, 1 }; 
}

class FigureO { 
    int[] block1 = { 1, 0 }; 
    int[] block0 = { 0, 0 }; 
    int[] block2 = { -1, 0 }; 
    int[] block3 = { -1, 1 }; 
}

class FigureS { 
    int[] block1 = { -1, 0 }; 
    int[] block0 = { 0, 0 }; 
    int[] block2 = { 0, 1 }; 
    int[] block3 = { 1, 1 }; 
}

class FigureT { 
    int[] block1 = { 1, 0 }; 
    int[] block0 = { 0, 0 }; 
    int[] block2 = { -1, 0 }; 
    int[] block3 = { 0, 1 }; 
}

class FigureZ { 
    int[] block1 = { 1, 0 }; 
    int[] block0 = { 0, 0 }; 
    int[] block2 = { -1, 1 }; 
    int[] block3 = { 0, 1 }; 
}

```

I have several questions regarding this in the order of importance:
-------------------------------------------------------------------

1)How do I make a paint from the Action class recognize changes in the Game memory class over time? 

2)When I put grid and figure variable into the Action class as well replacing the TimeListener from GameMemory to Action the figure does move indeed. What is the problem if I do it from another class then? 
I am trying to separate memory from painting because it seems logical to me. Is it possible? 

3)I have a file with a whole bunch of package-private classes that contain relative figure coordinates. In the beginning I was trying to make it a public class that contains private inner classes, but I ran into a problem of instantiating inner private classes, and so I am thinking how to have a better design for my file with figures. 

I am a complete noob in Java so any suggestions will be appreciated.