flashing screen with paint()

As I’ve mentioned before, my current project is a tilebased roguelike in the vein of nethack. All of the objects are displayed simply as characters in a grid. To display them, I’ve chosen to to just use java’s built in graphics.drawString(). After every “step”, I have the paint() method redraw the entire map.

public void paint(Graphics gr){
		super.paint(gr);
		GameObject map[][][] = mainMap.getMap();
		for(int i = 0; i < map.length; i++){
			for(int j = 0; j < map[0].length; j++){
				gr.drawString(Character.toString(map[i][j][0].getChar()), (i * 15) + 15, (j * 15) + 60);
			}
		}
	}

This works, but it causes the screen to flicker with every update. It appears to display a blank screen before displaying the new one. Is their someway to buffer the previous screen, and keep it displayed until the new one is ready to replace it?