Principe du programme , refaire un jeux que j'ai fait en javascript.
Il fonctionne sur http://deusgame.com c'est la partie jdr.

Mini Descriptif des classes :
Une page de connection
Une page d'affichage
Dans la page d'affichage on as une zone ou j'affiche le champ de vision .
Se champ de vision demande a chaque case une image
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
package jdr;
 
public abstract class Case {
	public abstract javax.swing.ImageIcon getImg();
	/*
	 * -1 = Inconnu
	 * 0 = N'est pas un obstacle
	 * 1 = Dois Savoir nager ( Eau )
	 * 2 = Est un joueur actif
	 * 3 = Est un pnj
	 * 4 = Est un Mur
	 * 5 = Est une ressources
	 */
	public abstract int getObstacle();
}
Pour cela elle demande a carte la case :
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
	// Liste des Personnes
	private HashMap<Integer , Personne> listePersonne = new HashMap<Integer , Personne>(size_x*size_y);
	// Carte
	private Case[][] terrain ;
 
............
 
public Case getCase(int x , int y){ 
		synchronized (listePersonne){
			// Prerequis
			if ( ( x >= size_x ) || ( x < 0 ) ) return null;
			if ( ( y >= size_y ) || ( y < 0 ) ) return null;
			// On regarde le hashcode via la position de la personne,
			// cette derniere etant unique, elle nous sert de repaire.
			Personne p = listePersonne.get( codePosi(x,y) ) ;
			if ( p != null ) return p;
			// Si la case ne contient pas une personne, 
			// alors on renvoye le terrain.
			return terrain[x][y];
		}
	}
Le terrains fonctionne bien : ( image local --> jar )
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
package jdr;
/*
 * @Autor Ungar Didier
 * @Autor Desplanque Valentin
 * 
 * @version 1.0.0.0
 */
import javax.swing.ImageIcon;
 
 
public class Terrain extends Case{
	private static ImageIcon imgNone = null;
	private static ImageIcon img_a = null;
	private static ImageIcon img_c = null;
	private static ImageIcon img_C = null;
	private static ImageIcon img_d = null;
	private static ImageIcon img_e = null;
	private static ImageIcon img_f = null;
	private static ImageIcon img_F = null;
	private static ImageIcon img_h = null;
	private static ImageIcon img_g = null;
	private static ImageIcon img_m = null;
	private static ImageIcon img_n = null;
	private static ImageIcon img_o = null;
	private static ImageIcon img_p = null;
	private static ImageIcon img_P = null;
	private static ImageIcon img_r = null;
	private static ImageIcon img_R = null;
	private static ImageIcon img_s = null;
	private static ImageIcon img_t = null;
	private static ImageIcon img_T = null;
	private static ImageIcon img_v = null;
	private static ImageIcon img_vide = null;
 
	/*
	 * Constructeur :
	 */
	public Terrain(char c){
		switch (c) {
		case 'a' :// Arbre
			if ( img_a==null )
				img_a = new ImageIcon(getClass().getResource("img/arbre.gif"));
			img = img_a;
			obstacle=4;
			break;
		case 'c' :// Carpe
			if ( img_c==null )
				img_c = new ImageIcon(getClass().getResource("img/carp.gif"));
			img = img_c;
			obstacle=5;
			break;
		case 'C' :// Rascasse
			if ( img_C==null )
				img_C = new ImageIcon(getClass().getResource("img/rascasse.gif"));
			img = img_C;
			obstacle=5;
			break;
		case 'd' :// Deut
			if ( img_d==null )
				img_d = new ImageIcon(getClass().getResource("img/deut.jpg"));
			img = img_d;
			obstacle=5;
			break;
		case 'e' :// Eau
			if ( img_e==null )
				img_e = new ImageIcon(getClass().getResource("img/eau.gif"));
			img = img_e;
			obstacle=1;
			break;
		case 'f' :// Fleur
			if ( img_f==null )
				img_f = new ImageIcon(getClass().getResource("img/fleur.gif"));
			img = img_f;
			break;
		case 'F' :// Fer
			if ( img_F==null )
				img_F = new ImageIcon(getClass().getResource("img/fer.jpg"));
			img = img_F;
			obstacle=5;
		break;
		case 'h' :// Herbe
			if ( img_h==null )
				img_h = new ImageIcon(getClass().getResource("img/herbe.jpg"));
			img = img_h;
			break;
		case 'g' :// Fruit
			if ( img_g==null )
				img_g = new ImageIcon(getClass().getResource("img/fruit.gif"));
			img = img_g;
			obstacle=5;
			break;
		case 'm' :// Montagne
			if ( img_m==null )
				img_m = new ImageIcon(getClass().getResource("img/montagne.png"));
			img = img_m;
			break;
		case 'n' :// Neige
			if ( img_n==null )
				img_n = new ImageIcon(getClass().getResource("img/neige.jpg"));
			img = img_n;
			obstacle=4;
			break;
		case 'o' :// Mines d'or
			if ( img_o==null )
				img_o = new ImageIcon(getClass().getResource("img/or.jpg"));
			img = img_o;
			obstacle=5;
			break;
		case 'p' :// Pont
			if ( img_p==null )
				img_p = new ImageIcon(getClass().getResource("img/pont.jpg"));
			img = img_p;
			break;
		case 'P' :// Petrol
			if ( img_P==null )
				img_P = new ImageIcon(getClass().getResource("img/petrol.gif"));
			img = img_P;
			obstacle=5;
			break;
		case 'r' :// RouteH
			if ( img_r==null )
				img_r = new ImageIcon(getClass().getResource("img/routeH.gif"));
			img = img_r;
			break;
		case 'R' :// RouteV
			if ( img_R==null )
				img_R = new ImageIcon(getClass().getResource("img/routeV.gif"));
			img = img_R;
			break;
		case 's' :// Mines d'or
			if ( img_s==null )
				img_s = new ImageIcon(getClass().getResource("img/sable.jpg"));
			img = img_s;
			break;
		case 't' :// Terre
			if ( img_t==null )
				img_t = new ImageIcon(getClass().getResource("img/terre.jpg"));
			img = img_t;
			break;
		case 'T' :// Mines d'or
			if ( img_T==null )
				img_T = new ImageIcon(getClass().getResource("img/totem.gif"));
			img = img_T;
			obstacle=5;
			break;
		case 'v' :// Ville
			if ( img_v==null )
				img_v = new ImageIcon(getClass().getResource("img/ville.gif"));
			img = img_v;
			obstacle=5;
			break;
		case '*' :// Vide
			if ( img_vide==null )
				img_vide = new ImageIcon(getClass().getResource("img/vide.jpg"));
			img = img_vide;
			break;
		default:
			if ( imgNone==null )
				imgNone = new ImageIcon(getClass().getResource("img/NoImg.jpg"));
		img = imgNone;
		break;
 
		}
	}
	/*
	 * Variables :
	 */
	private int obstacle=0;
	public int getObstacle(){return obstacle;}
	private ImageIcon img = null;
	public ImageIcon getImg(){	return img;	}
}
Sur le même principe j'ai crée Monstre :
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
package jdr;
 
import javax.swing.ImageIcon;
 
public class Monstre extends Personne{
	/*
	 * Le serveur répond sous la forme :
	 * type posi_x posi_y id_type pv_act
	 * Exemple :
	 * m1 3 10 5
	 * Monstre en (1,3) de type 10 avec 5 pv
	 * On as a analyser :
	 * 1 3 10 5, car le 'm' as été analyser par carte
	 */
	public Monstre(String datas,Carte carte){
		datas.trim();
		String[] valeurs = datas.split(" ");
		x = 7+(Integer.valueOf(valeurs[0])-carte.getPosiX());
		y = 7-(Integer.valueOf(valeurs[1])-carte.getPosiY());
		id_type = Integer.valueOf(valeurs[2]);
		pv_act = Integer.valueOf(valeurs[3]);
		// As-t-on les informations sur se monstre ?
		if ( img_E[id_type]==null ) getInfo();
	}
	private void getInfo(){
		String reponce =new Http().post(Param.getServeur()+"jdr.php?act=info&type=m&id="+id_type, Param.getSession());
		reponce = reponce.trim();
		String[] datas = reponce.split("[|]");
		nom[id_type] = datas[0];
		pv_max[id_type] = Integer.valueOf(datas[1]);
		datas[2]=datas[2].trim();
		if ( datas[2].indexOf("http://") >=0 )
			img_E[id_type] = new ImageIcon(datas[2]);
		else if ( datas[2].length() > 0 ){
			datas[2] = "http://s193648367.onlinehome.fr/Deus/Skin/img/E/"+datas[2];
			img_E[id_type] = new ImageIcon(datas[2]);
		}
		if ( img_E[id_type]==null )
			img_E[id_type] = new ImageIcon("img/NoImg.jpg");
	}
	private int x;
	public  int getX(){return x;}
	private int y;
	public  int getY(){return y;}
	public  int getObstacle(){return 3;}
	private int id_type;
	private String nom[] = new String[250];;
	private int pv_act;
	private int pv_max[] = new int[250];
	public String getTitle(){return nom[id_type]+" ("+pv_act+"/"+pv_max[id_type]+")";}
	private static ImageIcon img_E[] = new ImageIcon[250];
	public  ImageIcon getImg(){ return img_E[id_type]; }
}
Remarque Personne est une case ( il en découle, PJ et PNJ )
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
package jdr;
 
public abstract class Personne extends Case{
	public abstract int getX();
	public abstract int getY();
}
Mon bug :
Lorsque je voit un monstre sont image ne se charge pas.
Je suppose que le thread de swing n'as pas raffrechi l'écrant une fois l'image charger.

Comment corriger l'erreur.