Hello,

I have a card game java assignment. When I click in one card, the cards around will turn around and I have to show in my applet. At the same time I need to show in a frame (without clicking the frame) the card that was clicked by turning around only this card. I have 2 different classes used to construct the fields and I was thinking of using the same event handler but I don´t know how to implement it.
Here is the code for the applet:

Java Code:
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.Panel;

public class FarbMosaik extends Panel
{
	private ModelIF model;
	public MosaikEventHandler eventHandler;

	public FarbMosaik(int raster, int breite, Color farbeRueckseite, Color farbeVorderseite)
	{
	   model = new MosaikModel(raster, raster);
	   eventHandler = new MosaikEventHandler (model);
	   this.setLayout(new GridLayout(raster, raster, 1, 1));
	   int canvasBreite=breite/raster;

	   for (int i=0; i< raster; i++)
	   {
		for (int j=0; j< raster; j++)
		{
		   MosaikCanvas mc = new MosaikCanvas(i, j, farbeRueckseite, farbeVorderseite);
		   mc.addMouseListener(eventHandler);
		   model.putObj(i, j, mc);
		   mc.setSize(canvasBreite, canvasBreite);
		   this.add(mc);
		}
	   }
	}
		
	
}
eventhandler:

Java Code:
import java.awt.*;
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;
import java.util.Hashtable;
import java.util.Enumeration;


public class MosaikEventHandler
implements MouseListener
{
		
	Hashtable modelTable;
	Object key;
	
	private int zeile, spalte;

	public MosaikEventHandler(ModelIF model)
	{
	   modelTable = new Hashtable();
	   addModel(model);
	}	

	public void mouseClicked(MouseEvent me){}
	public void mouseEntered(MouseEvent me){}
	public void mouseExited(MouseEvent me){}
	public void mousePressed(MouseEvent me){}
	
	public void mouseReleased (MouseEvent me)
	{
	   
	   zeile = ((MosaikIF)me.getSource()).getZeile();
	   spalte = ((MosaikIF)me.getSource()).getSpalte();	

	   Enumeration enum = modelTable.keys();
		while(enum.hasMoreElements())
		{
		   key=enum.nextElement();
		   ((ModelIF)modelTable.get(key)).action(zeile, spalte);
		}	 

	}
	
	public void addModel(ModelIF model)
	{
	   key=new Integer(model.hashCode());
	   modelTable.put(key, model);
	}

	public ModelIF removeModel(ModelIF model)
	{
	   key=new Integer(model.hashCode());
	   return (ModelIF)modelTable.remove(key);
	}
	

}
here is the code for the frame:

Java Code:
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.Frame;

public class FrameMosaik extends Frame
{
	private ModelIF model;
	private MosaikEventHandler eventHandler;

	public FrameMosaik(int raster, int breite, Color farbeRueckseite, Color farbeVorderseite)
	{
	   model = new MosaikModel(raster, raster);
	   	   
	   eventHandler = new MosaikEventHandler (model);
	   this.setLayout(new GridLayout(raster, raster, 1, 1));
	   int canvasBreite=breite/raster;

	   for (int i=0; i< raster; i++)
	   {
		for (int j=0; j< raster; j++)
		{
		   MosaikCanvas mc = new MosaikCanvas(i, j, farbeRueckseite, farbeVorderseite);
		   
		   //mc.addMouseListener(eventHandler);
		   model.putObj(i, j, mc);
		   mc.setSize(canvasBreite, canvasBreite);
		   this.add(mc);
		}
	   }
	}	
	
}
What change would I need to do to the frame code in order to obtain the desired result?

It would be great if someone could help me with this.

thanks