At the moment I am writing a rogue in java. How I am doing it is creating a class that extends JPanel which has char[][] and Color[][] Buffers. Writing the map to the screen all you need to do is override the JPanel's paintComponent(Graphics g) method:
public class MyJPanel extends JPanel
{
private Color[][] cColors; //The Colors of the map
private char[][] chChar; //The characters of the map
public MyJPanel()
{
cColors = new Color[20][20];
chChar = new char[20][20];
for(int iy = 0; iy < 20; iy++)
for(int ix = 0; ix < 20; ix++)
{
cColor[ix][iy] = Color.WHITE;
chChar[ix][iy] = '#';
}
}
//This overrides JPanel's paintComponent method
public void paintComponent(Graphics g)
{
super.paintComponent(g); //Always do this first when overriding paintComponent
for(int iy = 0; iy < 20; iy++)
for(int ix = 0; ix < 20; ix++)
{
g.setColor(cColors[ix][iy];
g.drawString(String.valueOf(chChar[ix][iy]),
StartX + (CharSpace * ix),
StartY + (LineSpace * iy));
}
}
}
In the g.drawString method:
StartX: is the pixel you wish to start drawing on the X axis,
StartY: is the pixel you wish to start drawing on the Y axis
CharSpace: is how I create spacing between each character - X axis spacing
LineSpace: is how I create spacing between each Line - Y axis spacing
Now if you wish to use tile graphics instead g has a many drawImage methods.
g has many methods in it to draw graphics onto a JPanel.
I hope this helps
Taffer