-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThemes.java
87 lines (80 loc) · 2.44 KB
/
Themes.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
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
import java.awt.event.ActionEvent;
import javax.swing.*;
import java.awt.* ;
import javax.swing.border.LineBorder;
import javax.swing.border.SoftBevelBorder;
/**
*
* @author Salahdine Ouhmmiali v 1.0
*
*/
/* Afficher les thèmes sur l'interface graphique */
public class Themes extends JPanel {
JButton th1,th2,th3,th4,th5,th6;
static int numero; // pour désigner le theme choisi par l'utilisateur
static boolean go = false ;
/* Constructeur de la frame Themes */
Themes(JFrame window){
setSize(window.getSize().width,window.getSize().height);
setLayout(null);
setBackground(Color.DARK_GRAY);
window.setContentPane(this);
th1 = new JButton ("Types de données");
th1.setBackground(new Color(255,255,255)) ;
th1.setBounds(300,50,200,50);
add(th1);
th2 = new JButton ("Chaines de caractère : String");
th2.setBackground(new Color(255,255,255)) ;
th2.setBounds(300,110,200,50);
add(th2);
th3 = new JButton ("Tableaux");
th3.setBackground(new Color(255,255,255)) ;
th3.setBounds(300,170,200,50);
add(th3);
th4 = new JButton ("Exception");
th4.setBackground(new Color(255,255,255)) ;
th4.setBounds(300,230,200,50);
add(th4);
th5 = new JButton ("Collections");
th5.setBackground(new Color(255,255,255)) ;
th5.setBounds(300,290,200,50);
add(th5);
}
/* Ajouter les actions pour chaque boutton */
void choose () {
th1.addActionListener((ActionEvent e) -> {
go = true ;
numero = 1;
setVisible(false);
});
th2.addActionListener((ActionEvent e) -> {
go = true ;
numero = 2;
setVisible(false);
});
th3.addActionListener((ActionEvent e) -> {
go = true ;
numero = 3;
setVisible(false);
});
th4.addActionListener((ActionEvent e) -> {
go = true ;
numero = 4;
setVisible(false);
});
th5.addActionListener((ActionEvent e) -> {
go = true ;
numero = 5;
setVisible(false);
});
while (!go) {
try {
Thread.sleep(0);
} catch (InterruptedException ex) {}
}
go = false ;
}
public int getNumero() {
return numero;
}
}