Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Cours.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void createPan(JLabel border,JPanel panel) {
case 1 : createPan(border,panel);
JLabel cour = new JLabel("<html> * On distingue deux genres de types de données sur Java :\n" +
"<br> -Types primitifs : byte, short, int, long, float, double,boolean et char.\n" +
<<<<<<< Updated upstream
"<br> -Types non-primitifs : String, Arrays, Classes …\n" +
"<br>"+
"<br>"+
Expand All @@ -43,16 +44,36 @@ void createPan(JLabel border,JPanel panel) {
"<br> -int : stocke les entiers jusqu’à 10 digits.\n" +
"<br> -double & float : pour stocker les nombres à virgule flottante.\n" +
"<br> -char: stocke les caractères (lettres, signes ou nombres).\n" +
=======
"<br> -Types non-primitifs : String, Arrays, Classes …\n" +
"<br>"+
"<br>"+
"<br> * Types de données primitifs de base:\n" +
"<br>"+
"<br> -byte : stocke les nombres entre -128 à 127.\n" +
"<br> -int : stocke les entiers jusqu'à  10 digits.\n" +
"<br> -double & float : pour stocker les nombres à virgule flottante.\n" +
"<br> -char: stocke les caractères (lettres, signes ou nombres).\n" +
>>>>>>> Stashed changes
"<br> -boolean : type logique qui prend les valeurs true et false.\n" +
"<br>"+
"<br>"+
"<br> * Strings\n" +
<<<<<<< Updated upstream
"<br> Les chaînes de caractères sur Java sont de type string.\n" +
"<br>"+
"<br>Exemples :\n" +
"<br>String sequence = “ This is a string” ;\n" +
"<br> String concat = “ This” + “string” \n" +
" + “is” + “concatenated” ;\n" +
=======
"<br> Les chaînes de caractères sur Java sont de type string.\n" +
"<br>"+
"<br>Exemples :\n" +
"<br>String sequence = “ This is a string� ;\n" +
"<br> String concat = “ This� + “string� \n" +
" + “is� + “concatenated� ;\n" +
>>>>>>> Stashed changes
"\n" +
"\n" +
"</html>");
Expand Down
92 changes: 92 additions & 0 deletions Jouer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
import java.util.Arrays;

import javax.swing.*;
<<<<<<< Updated upstream
import java.awt.* ;
import javax.swing.border.LineBorder;
import javax.swing.border.SoftBevelBorder;
=======
import java.awt.*;
import javax.swing.border.LineBorder;
import javax.swing.border.SoftBevelBorder;

>>>>>>> Stashed changes
/**
* @author Salahdine Ouhmmiali
*/
/* La classe main */
public class Jouer {
<<<<<<< Updated upstream
public static void main(String[] args) throws InterruptedException {

JFrame window = new JFrame ("Jeu Java") ;
Expand Down Expand Up @@ -73,4 +81,88 @@ public static void main(String[] args) throws InterruptedException {

}
}
=======
JFrame window;
public static void main(String[] args) throws InterruptedException {
Jouer jeu = new Jouer();
}

public Jouer() {
initialize();
}

private void initialize() {
window = new JFrame("Jeu Java");
window.setSize(800, 500);
window.setLocationRelativeTo(null);
window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
window.setResizable(false);
while (true) {
// nbr1, nbr2 : numéro de la question dans qcm ou qrc
// score1, score2 : les scores dans qcm et qrc
int nbr1 = 0, nbr2 = 0, score1 = 0, m = 0, s = 0, score2 = 0;
int time = 60; // sec
PremierePage premierepage = new PremierePage(window);
premierepage.choose();
Themes themes = new Themes(window);
themes.choose();
// numero du theme choisi par l'utilisateur
int numero = Themes.numero;
SupportCours pagePrincipale = new SupportCours(window);
pagePrincipale.choose();
boolean isCour = SupportCours.cour;
Quizs quizs = new Quizs();
// Tous les qcm du jeu .
Qcm[] quiz_All = quizs.quizQcm();
// les qcm du thème choisi par l'utilisateur
Qcm[] quiz_theme = Arrays.copyOfRange(quiz_All, (numero - 1) * 4, numero * 4);
// tous les qrc du jeu
Qrc[] qrcs = quizs.quizQrc();
Qrc[] qrcs_theme = Arrays.copyOfRange(qrcs, numero - 1, numero);

// Qcm
while (nbr1 != quiz_theme.length) {
QcmFrame quiz = new QcmFrame(quiz_theme[nbr1], window);
try {
quiz.getAnswer(time);
} catch (InterruptedException i) {
System.out.println(i.getMessage());
}
m = quiz.getTime().M;
s = quiz.getTime().S;
score1 = quiz.getScore();
if (nbr1 == quiz_theme.length - 1 || (s == time)) {
quiz.Reset();
}
nbr1++;
}

// Qrc
while (nbr2 != qrcs_theme.length) {
QrcFrame quiz = new QrcFrame(qrcs_theme[nbr2], window);
try {
quiz.getAnswer(time);
} catch (InterruptedException i) {
System.out.println(i.getMessage());
}
m = quiz.getTime().M;
s = quiz.getTime().S;
score2 = quiz.getScore();
if (nbr2 == qrcs_theme.length - 1 || (s == time)) {
quiz.Reset();
}
nbr2++;
}
// nb total du question du test passé
int nbrQ = qrcs_theme.length + quiz_theme.length;
// score total du test passé
int score = score1 + score2;
// Afficahe du score sur l'interface graphique
Score scorePage = new Score(window, score, nbrQ);
// Obtenir le choix de l'utilisateur ( Quitter ou Recommencer )
scorePage.choose();

}
}
>>>>>>> Stashed changes
}
33 changes: 22 additions & 11 deletions LoginGUI.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import java.awt.EventQueue;

/**
*
* @author Houssem Radhouane
*
*/

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
Expand All @@ -26,16 +32,15 @@ public class LoginGUI {
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
// EventQueue.invokeLater(new Runnable() {
// public void run() {
// try {
LoginGUI window = new LoginGUI();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// });
}

/**
Expand All @@ -53,7 +58,7 @@ private void initialize() {
frame.setResizable(false);
frame.setBounds(100, 100, 835, 570);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);
JPanel panel = new JPanel();
panel.setBackground(new Color(105, 105, 105));
frame.getContentPane().add(panel, BorderLayout.CENTER);
Expand Down Expand Up @@ -83,6 +88,7 @@ private void initialize() {
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SignInGUI login = new SignInGUI();
frame.dispose();
}
});
btnNewButton.setFont(new Font("Tahoma", Font.PLAIN, 22));
Expand All @@ -101,12 +107,17 @@ public void actionPerformed(ActionEvent e) {
panel_1.add(btnCrerUnCompte);

JButton btnQuitter = new JButton("Quitter");
btnQuitter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
btnQuitter.setBackground(Color.LIGHT_GRAY);
btnQuitter.setFont(new Font("Tahoma", Font.PLAIN, 22));
btnQuitter.setBounds(91, 209, 210, 38);
panel_1.add(btnQuitter);

JLabel lblNewLabel = new JLabel("JLP");
JLabel lblNewLabel = new JLabel("J7");
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setBounds(247, 68, 309, 63);
layeredPane.add(lblNewLabel);
Expand Down
6 changes: 6 additions & 0 deletions PremierePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ public class PremierePage extends JPanel {
themes.setBounds(300,150,200,50);
add(themes);

<<<<<<< Updated upstream
quitter = new JButton ("Quiter");
quitter.setBackground(new Color(255,255,255)) ;
quitter.setBounds(300,250,200,50);
add(quitter);
=======
>>>>>>> Stashed changes

window.setVisible(true);

Expand All @@ -34,10 +37,13 @@ void choose () {
go = true ;
setVisible(false);
});
<<<<<<< Updated upstream

quitter.addActionListener((ActionEvent e) -> {
System.exit(0);
});
=======
>>>>>>> Stashed changes

while (!go) {
try {
Expand Down
8 changes: 8 additions & 0 deletions QcmFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,23 @@ public class QcmFrame extends JPanel {
pan.setBackground(Color.DARK_GRAY);
window.setContentPane(pan);
setLayout(null);
<<<<<<< Updated upstream
setBackground(Color.getHSBColor(154, 254, 25));
=======
setBackground(Color.LIGHT_GRAY);
>>>>>>> Stashed changes
setBounds(100,90,600,300);
setBorder(BorderFactory.createLineBorder(Color.black));
pan.add(this);

add(Q); add(option1); add(option2); add(option3); add(option4);

Q.setBounds(40,8,520,150);
<<<<<<< Updated upstream
Q.setBorder(new LineBorder(Color.blue, 2, true));
=======
Q.setBorder(new LineBorder(Color.white, 2, true));
>>>>>>> Stashed changes
Q.setHorizontalAlignment(JLabel.CENTER);
option1.setBounds(80,180,200,40); option1.setBackground(new Color(255,255,255)) ;
option2.setBounds(80,240,200,40); option2.setBackground(new Color(255,255,255)) ;
Expand Down
8 changes: 8 additions & 0 deletions QrcFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,22 @@ public class QrcFrame extends JPanel {
pan.setBackground(Color.DARK_GRAY);
window.setContentPane(pan);
setLayout(null);
<<<<<<< Updated upstream
setBackground(Color.getHSBColor(154, 254, 25));
=======
setBackground(Color.LIGHT_GRAY);
>>>>>>> Stashed changes
setBounds(100,90,600,300);
setBorder(BorderFactory.createLineBorder(Color.black));
pan.add(this);
add(questionLabel); add(answer); add(yourAnswer); add(valider);

questionLabel.setBounds(40,8,520,150);
<<<<<<< Updated upstream
questionLabel.setBorder(new LineBorder(Color.blue, 2, true));
=======
questionLabel.setBorder(new LineBorder(Color.white, 2, true));
>>>>>>> Stashed changes
questionLabel.setHorizontalAlignment(JLabel.CENTER);
yourAnswer.setBounds(80,180,100,40);
yourAnswer.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED));
Expand Down
41 changes: 41 additions & 0 deletions QrcGUI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import java.awt.EventQueue;

import javax.swing.JFrame;

public class QrcGUI {

private JFrame frame;

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
QrcGUI window = new QrcGUI();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the application.
*/
public QrcGUI() {
initialize();
}

/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

}
Loading