bonjour j'ai cette classe qui permet d'afficher une image dans une fenêtre l'image s'affiche mais le problème c'est qu'elle disparaît très rapidement :
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
 
import java.awt.Graphics;
import java.awt.Point;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
 
public class ImagedansFenetre extends JFrame
{
	private static final long serialVersionUID = 1053653991150137810L;
	public int y;
	public int x;
	public int height;
	public int width;
 
	public ImagedansFenetre(int width,int height, int x, int y) 
	{
		this.setSize(width,height);
		this.height = height;
		this.width = width;
		this.x = x - 10;
		this.y = y - 10;
	}
	public void start(BufferedImage image)
	{
		this.setAlwaysOnTop(true);
		this.setUndecorated(true);
                this.setLocation(new Point(this.x, this.y));
               this.setVisible(true);
		Graphics g = this.getGraphics();	
		g.drawImage(image,0,0,null);
		g.dispose();
	}
}
merci d'avance