Bonjour, je vous montre mon code et vous explique mon soucis:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
	public Fenetre2(int x,int y,int taux){
 
 
		this.setSize(400,400);
	JComponent central = new ConqueteMain(x, y,taux ); // le main
	//((CreationGrille) central).addImageClicker(new CliqueGrille());
	JPanel right = new JPanel();
	this.getContentPane().setLayout(new BorderLayout());
	this.getContentPane().add(central,BorderLayout.CENTER);
	this.getContentPane().add(right,BorderLayout.EAST);
 
	right.setLayout(new BoxLayout(right,BoxLayout.Y_AXIS));
	right.add(info);
	info.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
	right.add(info1);
	right.add(new JSeparator(SwingConstants.HORIZONTAL));
	right.add(infoGrilleX);
	right.add(infoGrilleY);
	right.add(typeTerrainLabel);
	right.add(proprietaireLabel);
	right.add(uniteeLabel);
 
	this.setJMenuBar(this.creationJmenu());
 
 
	}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 
public ConqueteMain(int x,int y,int taux) {
		X = x;
		Y=y;
		TAUX=taux;
 
		initData(x, y, taux);
		initLayout(x,y,taux);
		EvenementsPartie.debutPartie(etatDePartie);
 
 
	}
 
 
	private void initData(int x,int y,int taux) {
 
		JoueurHumain joueurHumain1 = new JoueurHumain("j1");
		JoueurHumain joueurHumain2 = new JoueurHumain("j2");
		joueurHumain1.setNumeroJoueur(1);
		joueurHumain2.setNumeroJoueur(2);
		joueurs.add(joueurHumain1);
		joueurs.add(joueurHumain2);
		etatDePartie = new EtatDePartie(joueurs.size(), joueurs);
		GenerateurCarte generateurCarte = new GenerateurCarte();
 
		try {
			grilleJeu = generateurCarte.genererCarte(x, y, taux, joueurs);
		} catch (WaterWoldExeption e) {
			e.printStackTrace();
 
		}
	}
 
	private void initLayout(int x,int y, int taux) {
		CreationGrille grille = new CreationGrille(grilleJeu, joueurs,etatDePartie);
 
		this.setLayout(new BorderLayout());
		this.add(grille);
 
 
		grille.addImageClicker(new CliqueGrille());
	}
 
 
 
 
	private class CliqueGrille extends CreationGrille.ImageClicker {
		public void click(MouseEvent arg0, CaseTerrain caseTerrain) {
 
			CoordonneesTerrain coordonneesTerrain;
			TerrainJeu terrain = caseTerrain.getTerrain();
			switch (terrain.getTypeTerrain()) {
			case MER:
 
				System.out.println("mer"); // un vieil affichage pour l
				// instant
				break;
			case PLAINE:
 
					if (arg0.getButton() == MouseEvent.BUTTON1) {
					clicDroit = false;
 
					ChoixAction choixAction = new ChoixAction(caseTerrain);
 
 
				} else {
					clicDroit =clickDroit(clicDroit, caseTerrain);
				}
 
				break;
			default:
				break;
			}
 
		}
	}

Donc voila le ConqueteMain est un JPanel qui dessine une grille . Fenetre2 recupère ce JPanel et crée un autre JPanel(right) a droite. A ce moment là , j aimerais que quand je clique sur une case de la grille je récupère les données de cette grille dans le panel de droite.