|
@@ -1,6 +1,8 @@
|
1
|
1
|
import javax.swing.*;
|
2
|
2
|
import java.awt.*;
|
3
|
3
|
|
|
4
|
+import static javax.swing.BoxLayout.*;
|
|
5
|
+
|
4
|
6
|
public class InterfacePrincipale extends JFrame
|
5
|
7
|
{
|
6
|
8
|
//Panel des catégories
|
|
@@ -24,16 +26,115 @@ public class InterfacePrincipale extends JFrame
|
24
|
26
|
private Bouton delQ;
|
25
|
27
|
private Bouton editQ;
|
26
|
28
|
private JComboBox comboQueRep;
|
27
|
|
- private JList list;
|
|
29
|
+ private JList listQ;
|
|
30
|
+
|
|
31
|
+ //image pour les boutons
|
|
32
|
+ private ImageIcon plusImg;
|
|
33
|
+ private ImageIcon delImg;
|
|
34
|
+ private ImageIcon editImg;
|
28
|
35
|
|
29
|
36
|
public InterfacePrincipale()
|
30
|
37
|
{
|
|
38
|
+ setTitle("Administration base de données de l'aplication BurgerQuizz");
|
|
39
|
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
40
|
+
|
|
41
|
+ loadImgBouton();
|
|
42
|
+ createPanelCategories();
|
|
43
|
+ createPanelReponses();
|
|
44
|
+ createPanelQuestion();
|
|
45
|
+
|
|
46
|
+ getContentPane().add(new JLabel(new ImageIcon("rsc/burgerquizz.png")), BorderLayout.NORTH);
|
|
47
|
+ pack();
|
31
|
48
|
setLocationRelativeTo(null);
|
32
|
|
- setTitle("Administration base de données de l'aplication BurgerQuizz ce titre est trop long");
|
33
|
49
|
setVisible(true);
|
34
|
50
|
}
|
35
|
51
|
|
36
|
|
- private void createPanelCategories(){}
|
37
|
|
- private void createPanelReponses(){}
|
38
|
|
- private void createPanelQuestion(){}
|
|
52
|
+ private void loadImgBouton()
|
|
53
|
+ {
|
|
54
|
+ plusImg = new ImageIcon("rsc/plus.png");
|
|
55
|
+ delImg = new ImageIcon("rsc/del.png");
|
|
56
|
+ editImg = new ImageIcon("rsc/edit.png");
|
|
57
|
+ }
|
|
58
|
+
|
|
59
|
+ private void createPanelCategories()
|
|
60
|
+ {
|
|
61
|
+ panCategories = new JPanel();
|
|
62
|
+ addC = new Bouton("Ajouter une catégorie", plusImg);
|
|
63
|
+ delC = new Bouton("Supprimer la catégorie", delImg);
|
|
64
|
+ editC = new Bouton("Modifier la catégorie", editImg);
|
|
65
|
+
|
|
66
|
+ String tab[] = {"a","b","c","d","e","f"};
|
|
67
|
+ listC = new JList(tab);
|
|
68
|
+ JScrollPane sp = new JScrollPane(listC,
|
|
69
|
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
|
70
|
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+ panCategories.setLayout(new BoxLayout(panCategories,Y_AXIS));
|
|
74
|
+ addC.setAlignmentX(CENTER_ALIGNMENT);
|
|
75
|
+ delC.setAlignmentX(CENTER_ALIGNMENT);
|
|
76
|
+ editC.setAlignmentX(CENTER_ALIGNMENT);
|
|
77
|
+
|
|
78
|
+ panCategories.add(addC);
|
|
79
|
+ panCategories.add(delC);
|
|
80
|
+ panCategories.add(sp);
|
|
81
|
+ panCategories.add(editC);
|
|
82
|
+ getContentPane().add(panCategories, BorderLayout.WEST);
|
|
83
|
+ }
|
|
84
|
+
|
|
85
|
+ private void createPanelReponses()
|
|
86
|
+ {
|
|
87
|
+ panReponses = new JPanel();
|
|
88
|
+ addR = new Bouton("Ajouter un jeu de réponses", plusImg);
|
|
89
|
+ delR = new Bouton("Supprimer le jeu de réponses", delImg);
|
|
90
|
+ editR = new Bouton("Modifier le jeu de réponse", editImg);
|
|
91
|
+ comboRepCat = new JComboBox();
|
|
92
|
+
|
|
93
|
+ String tab[] = {"a","b","c","d","e","f"};
|
|
94
|
+ listR = new JList(tab);
|
|
95
|
+ JScrollPane sp = new JScrollPane(listR,
|
|
96
|
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
|
97
|
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+ panReponses.setLayout(new BoxLayout(panReponses,Y_AXIS));
|
|
101
|
+ addR.setAlignmentX(CENTER_ALIGNMENT);
|
|
102
|
+ delR.setAlignmentX(CENTER_ALIGNMENT);
|
|
103
|
+ editR.setAlignmentX(CENTER_ALIGNMENT);
|
|
104
|
+
|
|
105
|
+ panReponses.add(addR);
|
|
106
|
+ panReponses.add(delR);
|
|
107
|
+ panReponses.add(sp);
|
|
108
|
+ panReponses.add(editR);
|
|
109
|
+ panReponses.add(comboRepCat);
|
|
110
|
+ getContentPane().add(panReponses, BorderLayout.CENTER);
|
|
111
|
+ }
|
|
112
|
+
|
|
113
|
+ private void createPanelQuestion()
|
|
114
|
+ {
|
|
115
|
+ panQuestions = new JPanel();
|
|
116
|
+ addQ = new Bouton("Ajouter une question", plusImg);
|
|
117
|
+ delQ = new Bouton("Supprimer la question", delImg);
|
|
118
|
+ editQ = new Bouton("Modifier la question", editImg);
|
|
119
|
+ comboQueRep = new JComboBox();
|
|
120
|
+
|
|
121
|
+ String tab[] = {"a","b","c","d","e","f"};
|
|
122
|
+ listQ = new JList(tab);
|
|
123
|
+ JScrollPane sp = new JScrollPane(listQ,
|
|
124
|
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
|
125
|
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+ panQuestions.setLayout(new BoxLayout(panQuestions,Y_AXIS));
|
|
129
|
+ addQ.setAlignmentX(CENTER_ALIGNMENT);
|
|
130
|
+ delQ.setAlignmentX(CENTER_ALIGNMENT);
|
|
131
|
+ editQ.setAlignmentX(CENTER_ALIGNMENT);
|
|
132
|
+
|
|
133
|
+ panQuestions.add(addQ);
|
|
134
|
+ panQuestions.add(delQ);
|
|
135
|
+ panQuestions.add(sp);
|
|
136
|
+ panQuestions.add(editQ);
|
|
137
|
+ panQuestions.add(comboQueRep);
|
|
138
|
+ getContentPane().add(panQuestions, BorderLayout.EAST);
|
|
139
|
+ }
|
39
|
140
|
}
|