Bonjour,
J'ai rechercher avec google mon ami la résolution du :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
The program '.' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadPixmap (invalid Pixmap parameter)'.
  (Details: serial 65937 error_code 4 request_code 56 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
Il en est ressortit que plusieur thread tente de mettre a jour mon interface graphique.

J'en est donc retiré les .refresh,
mais le probléme persiste comment raisoudre le pobléme ?

Exemple d'interface avec le probléme :
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
package jdr;
import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
 
import javax.swing.*;
 
import java.awt.event.*;
 
 
 
public class FrameJDR extends AbstractAction implements KeyListener,EcouteurMiseAJour{
	/** Définition **/
//	private final static String Fr_Attaque = "";
 
	/** Variables **/
 
	/** Interface **/
	private volatile JTextField txtTchat = new JTextField( "" , 30 );
	private volatile JLabel lbTchat;
	private Tchat trdTchat;
	private JButton monde[][] ;// a initialise
	private JPanel panelCenter = new JPanel();
 
	/** Outils **/
	private Var var = new Var("Pref");
	private JFrame fenaitre;
	private Carte carte = new Carte();
 
	/** Constructeur **/
	public FrameJDR(){
		/*  Fenaitre */
		super();
		/* Délcaration de l'interface */
		carte.addEcouteurMiseAJour(this);
		/* Interface */
		fenaitre = new JFrame();
		/* Aspect */
		fenaitre.setTitle("JDR");
//		fl.setSize(800,600);
		fenaitre.setBounds(java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds());
 
		fenaitre.setVisible(true);
 
		fenaitre.setIconImage(new ImageIcon(getClass().getResource("img/favicon.gif")).getImage());
		fenaitre.setLocationRelativeTo(null); //On centre la fentre sur l'écran
		fenaitre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		/* Zone de positionnement */
		JPanel panel = new JPanel();
		BorderLayout struct = new BorderLayout();
		fenaitre.setContentPane(panel);
		panel.setLayout(struct);
		if (var.isVar("bg")){// Couleur de fond
			panel.setBackground(new Color(new Integer(var.getVar("bg"))));
		}else{
			panel.setBackground(Color.BLACK);
		}
		/* Site : ( North ) */
		JPanel panelNorth = new JPanel();
		/***
                 * Menu :
                 ***/
		JMenuBar menu = new JMenuBar();
		JMenu mnAbout = new JMenu("?");
		menu.add(mnAbout);
		JMenuItem mnThinksTo = new JMenuItem("Remerciement");
		mnAbout.add(mnThinksTo);
		mnThinksTo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent ae) {
				JOptionPane.showMessageDialog(new Frame(),
						"Chef de projet :\n"+
						"Ungar Didier\n"+
						"Programmeurs :\n"+
						"Ungar Didier\n"+
						"Desplanque Valentin"+
						"Relectrice :\n"+
						"Le Tiec Alexandra\n"+
				"Mais aussi les testeurs...");
			}
		});
		panelNorth.add(menu);
 
		panel.add(panelNorth,BorderLayout.NORTH);
		panelNorth.setBackground(panel.getBackground());
		/* Quit : ( South ) */
		JPanel panelSouth = new JPanel();
		//	Vie
		JProgressBar barVie;
		barVie = new JProgressBar(0, 100);
		barVie.setValue(20);
		barVie.setStringPainted(true);
		barVie.setBackground(Color.WHITE);
		barVie.setForeground(Color.RED);
		panelSouth.add(barVie);
		// Action
		JComboBox lstAct = new JComboBox();
		lstAct.addItem("Attaque Corp à Corp");
		lstAct.addItem("Attaque Distance");
		lstAct.addItem("Sort de soin léger");
		lstAct.addItem("Sort de soin lourd");
		lstAct.addItem("Sort de boule de feu");
		lstAct.addItem("Sort d'aura foudroyante");
		panelSouth.add(lstAct);
		// Bouton
		JButton bt_Sac = new JButton("Sac");
		bt_Sac.addActionListener(this);
		panelSouth.add(bt_Sac);
		// Mana
 
		//	Vie
		JProgressBar barMana;
		barMana = new JProgressBar(0, 100);
		barMana.setValue(20);
		barMana.setStringPainted(true);
		barMana.setBackground(Color.WHITE);
		barMana.setForeground(Color.BLUE);
		panelSouth.add(barMana);
		// Général
		panel.add(panelSouth,BorderLayout.SOUTH);
		panelSouth.setBackground(panel.getBackground());
		/* Resultat : ( Center ) */
		panelCenter.setLayout(new GridLayout(carte.getSizeX(),carte.getSizeY()));
 
 
 
		monde = new JButton[carte.getSizeX()][carte.getSizeY()];
		for (int y=0 ; y<carte.getSizeY() ; y++){
			for (int x=0 ; x<carte.getSizeX() ; x++){
				monde[x][y] = new JButton("");// On crée la case
				panelCenter.add(monde[x][y]);// On place la case
				monde[x][y].addActionListener(new ActCase(x,y));// On rend interactif
			}
		}// Affichage du monde
		affCentre();
 
		panel.add(panelCenter,BorderLayout.CENTER);
		panelCenter.setBackground(panel.getBackground());
 
		/* Menu : ( West ) */
		JPanel panelWest = new JPanel();
		panelWest.setLayout(new BoxLayout(panelWest,BoxLayout.Y_AXIS));
		panel.add(panelWest,BorderLayout.WEST);
		panelWest.setBackground(panel.getBackground());
 
		/* Options : ( East ) */
		JPanel panelEast = new JPanel();
		panelEast.setLayout(new BoxLayout(panelEast,BoxLayout.Y_AXIS));
		panelEast.add(txtTchat);
		JButton bt_Dire = new JButton("Dire");
		bt_Dire.addActionListener(this);
		panelEast.add(bt_Dire);
		lbTchat = new JLabel();
		trdTchat = new Tchat(lbTchat);
		trdTchat.start();
		panelEast.add(lbTchat);
		panel.add(panelEast,BorderLayout.EAST);
		panelEast.setBackground(panel.getBackground());
 
		// Relation
		txtTchat.addKeyListener(this);
		// Affichage
		fenaitre.setVisible(true);
	}
	/** Affichages **/
	/*
	 * Calcul/Recalcul le tableaux de la carte
	 */
	private void affCentre(){
		panelCenter.setLayout(new GridLayout(carte.getSizeY(),carte.getSizeX()));
		for (int y=0 ; y < carte.getSizeY() ; y++ ){
			for (int x=0 ; x < carte.getSizeX() ; x++ ){
				if ( carte.getCase(x, y) != null ){
					if ( carte.getCase(x, y).getImg() != null )
						monde[x][y].setIcon( carte.getCase(x, y).getImg() );
					else{
						monde[x][y].setIcon( null );
						monde[x][y].setText( new Integer(carte.getCase(x, y).getObstacle()).toString() );
					}
				}else{
					monde[x][y].setIcon( null );
					monde[x][y].setText("?");
				}
				monde[x][y]
				         .setToolTipText("Position : ("
				        		 +(carte.getPosiX()-7+x)+","
				        		 +(carte.getPosiY()+7-y)+")");
			}
		}
		//panelCenter.repaint();
		//fenaitre.repaint();
	}
	public synchronized void miseAJour(){
		affCentre();
	}
	/** Interface **/
	public void actionPerformed(ActionEvent e) {
		if ( e.getActionCommand()=="Dire" ){
			trdTchat.dire(txtTchat.getText());
			txtTchat.setText("");
		}else
			System.err.println(e.getActionCommand());
	}
	public void keyTyped(KeyEvent e) {
	}
 
	public void keyReleased(KeyEvent e) {
	}
	public void keyPressed(KeyEvent e) {
		if (e.getKeyCode() == KeyEvent.VK_ENTER ){
			trdTchat.dire(txtTchat.getText());
			txtTchat.setText("");
		}
	}
 
	/* Classe interne pour la gestion des cliques sur la carte */
	class ActCase extends AbstractAction{
		private int x;
		private int y;
		public ActCase(int x,int y){
			this.x=x;
			this.y=y;
		}
		/* Gestion des cliques sur la carte : */
		public void actionPerformed(ActionEvent e){
			if ( carte.getCase(x,y) == null )
				return;
			if ( carte.getCase(x,y).getObstacle() <= 1)// Déplacement
				carte.mov(x-7, -y+7);
			else if ( carte.getCase(x,y).getObstacle() == 3)// Monstre
				monde[x][y].setIcon( new ImageIcon("img/attaque.gif") );
		}
	}
	/** Accesseur **/
 
 
 
	/** Testeur **/
	public static void main(String[] args){
		new FrameJDR( );
	}
}
lbTchat = new JLabel();
trdTchat = new Tchat(lbTchat);
trdTchat.start();

Ici le thread trdTchat mets a jour lbTchat
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
package jdr;
import javax.swing.JLabel;
 
 
 
public class Tchat extends Thread implements Runnable{
	private JLabel lbTchat=null;
	private volatile Http http = new Http();
	private volatile String lastTime = "";
	private String lastDire = "";
 
	Tchat(JLabel lb){
		lbTchat = lb;
	}
	private void miseAJour(){
		if ( lastTime != http.get(Param.getServeur()+"/last.txt") ){
			refresch();
		}
		return ;
	}
	public void refresch(){
		// On note la date de la derniére mise a jour ( maintenant )
		lastTime = new Http().post(Param.getServeur()+"/jdr.php?act=lastTchat",Param.getSession());
		// Met a jour le tchat.
		String txt = ("<html><font color=white>"+
				new Http().post(Param.getServeur()+"/jdr.php?act=tchat",Param.getSession())
				+"</font></<html>");
		// Je regarde si je doit changer le text, c'est inutile de changer pour rien.
		if ( lbTchat.getText()!=txt){
			lbTchat.setText(txt);
		}
	}
	public void dire(String text){
		if ( text.equals("") ) return;// Je retire les envoye vide
		if ( text.length() <= 0 ) return; // Je retire les erreur de text ( vide et autre )
		if ( text.equals(lastDire) ) return;// Je retire les floods identique
		http.post(Param.getServeur()+"/jdr.php?act=dire",Param.getSession()+"&txt="+text);
		refresch();
		lastDire = text;
	}
	public synchronized void run(){// Pas la peine de faire plusieur requette en même temp
		if ( lbTchat!=null )
			lbTchat.setText("<html><font color=blue>Tchat Chargement en cours</font><br><font color=red>Toutes insultes sont interdites .</font></html>");
		try {
			sleep(5000);
		} catch (InterruptedException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		while( lbTchat!=null ){
			miseAJour();// Mise a jour du tchat
			try {
				sleep(1000);// toute les 1 seconde
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return;
	}
}