Bonjour,

J'ai besoin d'aide pour ajouter un background à ma frame.
Le problème à l'air simple vue comme ça (elle l'ait sans doute) mais aucune de mes recherches m'ont permise de trouver une réponse.

J'arrive tout de même à faire apparaitre mon image, mais elle est en premier plan. Ma frame possède une grille (à la candy crush) et j'aimerais mettre l'image derrière.

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
public void initTab() {
		JPanel temp = new JPanel();
		this.add(temp);
		this.tab = new Couleur[10][15];
		this.tabi = new int[10][15];
 
		Random random = new Random();
		int alea;
 
 
		temp.setLayout(new GridLayout(10,15,0,0));
		for(int i = 0;i<10;i++) {
			for(int j=0; j<15; j++) {
				alea = random.nextInt(3);
				if(alea == 0) {
					this.tab[i][j] = new Muffin();
					temp.add(tab[i][j]);
					this.tabi[i][j] = 1;
				}
 
				if(alea == 1) {
					this.tab[i][j] = new Cookie();
					temp.add(tab[i][j]);
					this.tabi[i][j] = 2;
				}
 
				if(alea == 2) {
					this.tab[i][j] = new Bonbon();
					temp.add(tab[i][j]);
					this.tabi[i][j] = 3;
				}
			}
		}
		this.setSize(800, 800);
		this.setLocationRelativeTo(null);
		this.setIconImage(new ImageIcon(getClass().getResource("/img/cookie.png")).getImage());
		this.setResizable(false);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
	}
Merci beaucoup !!