Ok, so I made a class called Tile. This class extends JLabel.
public Tile()
{
super();
}
Should behave the same as JLabel, no? but when I try to use it in my code, it does not show up in the correct position. If I do a call to the bounds of the Tile, it gives what I would expect, yet it is not AT that position. http://puu.sh/58eUg.jpg with the tile used, http://puu.sh/58eVT.png if I used JLabel in the places where Tile was called.
Container cPane = getContentPane();
for(int x = 0;x<8;x++)
{
for(int y = 0;y<8;y++)
{
grid[x][y] = new Tile();
grid[x][y].setBorder(BorderFactory.createLineBorder(Color.black));
grid[x][y].setBounds(50*x,50*y,100,100);
getContentPane().add(grid[x][y]);
cPane.add(grid[x][y]);
}
}
Any help would be appreciated.