Clase Mapa
Public class Mapa
{
public int [][] mapa;
public Mapa()
{
int[][] mapa={{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,2,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,2,0},{0,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0},{0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0},{0,1,0,1,0,0,1,0,0,3,3,0,0,1,0,0,1,0,1,0},{0,1,1,1,1,1,1,0,3,3,3,3,0,1,1,1,1,1,1,0},{0,1,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,1,0},{0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0},{0,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0},{0,2,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,2,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};
}
public int getMap(int fil, int col)
{
return mapa[fil][col];
}
}
public class Tablero extends JPanel implements ActionListener
{
Mapa plano;
int posX=105;
int posY=100;
int [][] mapa;
public Tablero()
{
mapa= new int [11][20];
rellenar()
}
public void rellenar()
{
for (int i=0; i<11; i++)
{
for (int j=0; j<20; j++)
{
mapa[i][j]=plano.getMap(i,j); // Error NullPointerException
System.out.print(mapa[i][j]);
}
}
}
}