Kaynağa Gözat

evolution (pikachu evolue en raichu)

PCYoshi 9 yıl önce
ebeveyn
işleme
8fb1d0c7cd

BIN
java/rsc/burgerquizz.png Dosyayı Görüntüle


+ 8
- 0
java/src/Bouton.java Dosyayı Görüntüle

1
 import javax.swing.*;
1
 import javax.swing.*;
2
+import javax.swing.border.Border;
3
+import java.awt.*;
2
 
4
 
3
 public class Bouton extends JButton
5
 public class Bouton extends JButton
4
 {
6
 {
5
 	public Bouton(String text, Icon icon)
7
 	public Bouton(String text, Icon icon)
6
 	{
8
 	{
7
 		super(text, icon);
9
 		super(text, icon);
10
+		setBackground(Color.WHITE);
11
+		setFocusPainted(false);
12
+		Border border = BorderFactory.createLineBorder(Color.BLACK, 2);
13
+		//http://stackoverflow.com/questions/10274750/java-swing-setting-margins-on-textarea-with-line-border
14
+		setBorder(BorderFactory.createCompoundBorder(border, BorderFactory.createEmptyBorder(5, 5, 5, 5)));
15
+		setIconTextGap(10);
8
 	}
16
 	}
9
 }
17
 }

+ 106
- 5
java/src/InterfacePrincipale.java Dosyayı Görüntüle

1
 import javax.swing.*;
1
 import javax.swing.*;
2
 import java.awt.*;
2
 import java.awt.*;
3
 
3
 
4
+import static javax.swing.BoxLayout.*;
5
+
4
 public class InterfacePrincipale extends JFrame
6
 public class InterfacePrincipale extends JFrame
5
 {
7
 {
6
 	//Panel des catégories
8
 	//Panel des catégories
24
 	private Bouton delQ;
26
 	private Bouton delQ;
25
 	private Bouton editQ;
27
 	private Bouton editQ;
26
 	private JComboBox comboQueRep;
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
 	public InterfacePrincipale()
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
 		setLocationRelativeTo(null);
48
 		setLocationRelativeTo(null);
32
-		setTitle("Administration base de données de l'aplication BurgerQuizz ce titre est trop long");
33
 		setVisible(true);
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
 }