I am trying to create a simple matching game that allows the user to click on a box and the card is revealed and if 2 of the cards match then they stay dissplayed else the card returns to its original state the code i have so far is:

Code:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.Date;
public class MatchingPairs extends Applet implements MouseListener//, Runnable
{
	int xpos =- 1;
	int ypos =- 1;
	int noTries, noMatches;
	int elapsedTime;
	int gameStatus;
	//String gameStatus;
	//Thread elapsedTime;

	final int IMAGES = 5;
	Image[][] cards = new Image[IMAGES][IMAGES];

	public void init()
	{
		setBackground(Color.white);
		// Add the MouseListener to your applet
  		addMouseListener(this);
		for(int i = 0; i < IMAGES; i++)
		{
			cards[i][i] = getImage(getDocumentBase(), "pic" +i+ ".jpg");
		}
	}

	public void paint(Graphics g)
	{
		int xt = 0;
		int row;
		int col;
		int x, y;
		for (row = 0;  row < IMAGES;  row++) 
		{
			for ( col = 0;  col < IMAGES;  col++) 
			{
			//	x = col * IMAGES;
                	//	y = row * IMAGES;
				//if((row % 1) == (col % 1))
					g.drawImage(cards[col][col], xt, 0, this);
					xt+=cards[row][row].getWidth(null) + 10;
					xt+=cards[col][col].getHeight(null) + 10;
					//cards[i][i] = (int) (Math.random()*5);
				//if((row % 2) == (col % 2))
				//	g.drawImage(cards[col][col], xt, 0, this);
				//	xt+=cards[col][col].getWidth(null) + 10;	
			}
		}
	}

	public void mouseClicked(MouseEvent e) 
	{
		xpos = e.getX()/20;
		ypos = e.getY()/20;
		repaint();
	}

	public void mousePressed(MouseEvent e){}
	public void mouseEntered(MouseEvent e){}
	public void mouseReleased(MouseEvent e){}
	public void mouseExited(MouseEvent e){}

} // end class
but the images dont form a grid it displays in a single row
i want it to appear something like:
oooo
oooo
oooo
instead of ooooooooooo ooooooo
the "o" represents the images. any help would be appreciated.
thanks in advance.