-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.java
44 lines (35 loc) · 1.06 KB
/
Menu.java
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
import java.awt.*;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.util.*;
import javax.swing.filechooser.FileFilter;
public class Menu extends JPanel {
Image menu,select1,select2,select3;
int curseur;
public Menu(){
//initialisation des variables
this.curseur = 0;
//chargement des images
Toolkit kit=Toolkit.getDefaultToolkit();
MediaTracker tracker=new MediaTracker(this);
this.menu = kit.getImage("images/menu.jpg");
this.select1 = kit.getImage("images/select1.jpg");
this.select3 = kit.getImage("images/select3.jpg");
//les trackers c'est la vie !
tracker.addImage(menu,0);
tracker.addImage(select1,0);
tracker.addImage(select3,0);
try {tracker.waitForID(0);}
catch(InterruptedException e){}
}
public void paintComponent(Graphics g){
g.drawImage(this.menu,0,0,null);
if(curseur == 1) g.drawImage(this.select1,114,148,null);
else if(curseur == 3){ g.drawImage(this.select3,114,432,null);}
}
public void rafraichirMenu(int curseur){
this.curseur = curseur;
repaint();
}
}