From 831ee605270cc30a4939213d5a59b1c133360ca9 Mon Sep 17 00:00:00 2001 From: Clement Date: Wed, 18 Sep 2024 13:48:20 +0200 Subject: [PATCH 01/10] Connexion sql + panel questions --- src/main/resources/db.properties | 5 +++ src/main/resources/db.sql | 69 ++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 src/main/resources/db.properties create mode 100644 src/main/resources/db.sql diff --git a/src/main/resources/db.properties b/src/main/resources/db.properties new file mode 100644 index 0000000..985af6a --- /dev/null +++ b/src/main/resources/db.properties @@ -0,0 +1,5 @@ +server=wp.ldnr.fr +port=3306 +dbname=cda202401_jse_g5 +user=cda202401_jse_g5 +password=n3z3XS9y9z8jZOnB diff --git a/src/main/resources/db.sql b/src/main/resources/db.sql new file mode 100644 index 0000000..904bb6e --- /dev/null +++ b/src/main/resources/db.sql @@ -0,0 +1,69 @@ +-- phpMyAdmin SQL Dump +-- version 4.9.6 +-- https://www.phpmyadmin.net/ +-- +-- Hôte : localhost +-- Généré le : mer. 18 sep. 2024 à 10:40 +-- Version du serveur : 10.1.48-MariaDB-0+deb9u2 +-- Version de PHP : 7.4.33 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Base de données : `cda202401_jse_g5` +-- + +-- -------------------------------------------------------- + +-- +-- Structure de la table `questions` +-- + +CREATE TABLE `questions` ( + `id` int(11) NOT NULL, + `number` int(11) NOT NULL, + `level` int(11) NOT NULL, + `statement` text NOT NULL, + `answer` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- +-- Déchargement des données de la table `questions` +-- + +INSERT INTO `questions` (`id`, `number`, `level`, `statement`, `answer`) VALUES +(1, 1, 1, 'Comment ça va?', 'bieng'); + +-- +-- Index pour les tables déchargées +-- + +-- +-- Index pour la table `questions` +-- +ALTER TABLE `questions` + ADD PRIMARY KEY (`id`); + +-- +-- AUTO_INCREMENT pour les tables déchargées +-- + +-- +-- AUTO_INCREMENT pour la table `questions` +-- +ALTER TABLE `questions` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -- GitLab From b74d2d13bdc218e67d126d1d26231240f1cb2bf3 Mon Sep 17 00:00:00 2001 From: Clement Date: Wed, 18 Sep 2024 16:04:28 +0200 Subject: [PATCH 02/10] DAO questions + tests(bugged) --- pom.xml | 14 +++ src/main/java/beans/Question.java | 77 ++++++++++++ .../com/mycompany/groupe_05/Groupe_05.java | 11 +- .../com/mycompany/groupe_05/TestFrame.java | 32 +++++ src/main/java/dao/Dao.java | 47 ++++++++ src/main/java/dao/DaoQuestion.java | 111 ++++++++++++++++++ src/main/java/gui/QuestionsGui.java | 70 +++++++++++ src/main/java/sql/MariaDbConnection.java | 77 ++++++++++++ src/test/java/dao/DaoQuestionTest.java | 56 +++++++++ target/classes/beans/Drawing$DrawArea$1.class | Bin 1167 -> 1167 bytes target/classes/beans/Drawing$DrawArea$2.class | Bin 1530 -> 1530 bytes target/classes/beans/Drawing$DrawArea.class | Bin 2273 -> 2406 bytes target/classes/beans/Drawing.class | Bin 5102 -> 3647 bytes .../com/mycompany/groupe_05/Groupe_05.class | Bin 489 -> 810 bytes .../compile/default-compile/createdFiles.lst | 11 +- .../compile/default-compile/inputFiles.lst | 10 +- 16 files changed, 511 insertions(+), 5 deletions(-) create mode 100644 src/main/java/beans/Question.java create mode 100644 src/main/java/com/mycompany/groupe_05/TestFrame.java create mode 100644 src/main/java/dao/Dao.java create mode 100644 src/main/java/dao/DaoQuestion.java create mode 100644 src/main/java/gui/QuestionsGui.java create mode 100644 src/main/java/sql/MariaDbConnection.java create mode 100644 src/test/java/dao/DaoQuestionTest.java diff --git a/pom.xml b/pom.xml index 5cdb5d4..ffdd7d6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,6 +5,20 @@ Groupe_05 1.0-SNAPSHOT jar + + + org.mariadb.jdbc + mariadb-java-client + 3.4.1 + + + org.junit.jupiter + junit-jupiter-api + 5.10.2 + test + jar + + UTF-8 17 diff --git a/src/main/java/beans/Question.java b/src/main/java/beans/Question.java new file mode 100644 index 0000000..2d5f01b --- /dev/null +++ b/src/main/java/beans/Question.java @@ -0,0 +1,77 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package beans; + +/** + * + * @author Clément GROSSELLE + */ +public class Question { + private int id; + private int number; + private int level; + private String statement; + private String answer; + + public Question() { + } + + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } + + public void setId(int id) { + this.id = id; + } + + public int getLevel() { + return level; + } + + public void setLevel(int level) { + this.level = level; + } + + public String getStatement() { + return statement; + } + + public void setStatement(String statement) { + this.statement = statement; + } + + public String getAnswer() { + return answer; + } + + public void setAnswer(String answer) { + this.answer = answer; + } + + public int getId() { + return id; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Questions{"); + sb.append("id=").append(id); + sb.append(", number=").append(number); + sb.append(", level=").append(level); + sb.append(", statement=").append(statement); + sb.append(", answer=").append(answer); + sb.append('}'); + return sb.toString(); + } + + + + +} diff --git a/src/main/java/com/mycompany/groupe_05/Groupe_05.java b/src/main/java/com/mycompany/groupe_05/Groupe_05.java index 585e8f5..1efa59c 100644 --- a/src/main/java/com/mycompany/groupe_05/Groupe_05.java +++ b/src/main/java/com/mycompany/groupe_05/Groupe_05.java @@ -1,10 +1,17 @@ package com.mycompany.groupe_05; -import beans.Drawing; +import beans.Question; +import dao.DaoQuestion; public class Groupe_05 { public static void main(String[] args) { - Drawing Draw = new Drawing(); + new TestFrame(); + Question q = new Question(); + DaoQuestion daoq = new DaoQuestion(); + q = daoq.find(1); + System.out.println(q); + } + } diff --git a/src/main/java/com/mycompany/groupe_05/TestFrame.java b/src/main/java/com/mycompany/groupe_05/TestFrame.java new file mode 100644 index 0000000..fd559ce --- /dev/null +++ b/src/main/java/com/mycompany/groupe_05/TestFrame.java @@ -0,0 +1,32 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.mycompany.groupe_05; + +import gui.QuestionsGui; +import javax.swing.JFrame; +import javax.swing.JPanel; + +/** + * + * @author stag + */ +public class TestFrame extends JFrame { + JPanel qPane = new QuestionsGui(); + + public TestFrame() { + this.initGui(); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.setResizable(true); + this.pack(); + //this.setSize(300, 500); + this.setLocationRelativeTo(null); + this.setVisible(true); + } + + private void initGui() { + this.add(qPane); + this.setContentPane(qPane); + } +} diff --git a/src/main/java/dao/Dao.java b/src/main/java/dao/Dao.java new file mode 100644 index 0000000..1d95ae5 --- /dev/null +++ b/src/main/java/dao/Dao.java @@ -0,0 +1,47 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template + */ +package dao; + +import java.util.Collection; + +/** + * Interface CRUD sur le stockage des données + * @author Clément GROSSELLE + * @param La classe + */ +public interface Dao { + + /** + * Retourne l'objet lu en DB grâce à son identifiant ou null. + * @param id L'identifiant en DB de l'objet + * @return L'objet ou null + */ + T find(int id); + + /** + * Hydrate la DB avec l'objet fourni. Cet objet doit avoir un id null. + * @param obj + */ + void create(T obj); + + /** + * Supprime la ligne d'identifiant id dans la DB. + * @param id + */ + void delete(int id); + + /** + * Met à jour l'objet dans la DB. L'objet doit avoir un id non null. + * @param obj + */ + void update(T obj); + + /** + * Retourne toutes les lignes de la DB dans une collection. + * @return Collection contenant tous les objets hydratés par la DB. + */ + Collection all(); + +} diff --git a/src/main/java/dao/DaoQuestion.java b/src/main/java/dao/DaoQuestion.java new file mode 100644 index 0000000..608ed64 --- /dev/null +++ b/src/main/java/dao/DaoQuestion.java @@ -0,0 +1,111 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package dao; + +import beans.Question; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import sql.MariaDbConnection; + +/** + * + * @author Clément GROSSELLE + */ +public class DaoQuestion implements Dao { + + private final Connection connect = MariaDbConnection.getInstance(); + + private Question createBean(ResultSet rs) { + Question obj = new Question(); + try { + obj.setNumber(rs.getInt("number")); + obj.setLevel(rs.getInt("level")); + obj.setStatement(rs.getString("statement")); + obj.setAnswer(rs.getString("answer")); + } catch (SQLException ex) { + System.out.println("Impossible de parcourir le resultSet"); + } + return obj; + } + + @Override + public Question find(int id) { + Question q = null; + String sql = "SELECT * FROM questions WHERE id=?"; + try (PreparedStatement pstmt = connect.prepareStatement(sql)) { + pstmt.setInt(1, id); + ResultSet rs = pstmt.executeQuery(sql); + if (rs.next()) { + q = createBean(rs); + } + } catch (SQLException ex) { + throw new RuntimeException("Recherche impossible dans la table questions"); + } + return q; + } + + @Override + public void create(Question obj) { + String sql = "INSERT INTO questions (level, statement, answer) VALUES (?, ?, ?)"; + try (PreparedStatement pstmt = connect.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS)) { + pstmt.setInt(1, obj.getLevel()); + pstmt.setString(2, obj.getStatement()); + pstmt.setString(3, obj.getAnswer()); + pstmt.executeUpdate(); + ResultSet keys = pstmt.getGeneratedKeys(); + if (keys.next()) { + obj.setId(keys.getInt(1)); + } + } catch (SQLException ex) { + throw new RuntimeException("Insertion impossible dans la table questions"); + } + } + + @Override + public void delete(int id) { + String sql = "DELETE FROM questions WHERE id=?"; + try (PreparedStatement pstmt = connect.prepareStatement(sql)) { + pstmt.setInt(1, id); + pstmt.executeUpdate(); + } catch (SQLException ex) { + throw new RuntimeException("Suppression impossible dans la table questions"); + } + } + + @Override + public void update(Question obj) { + String sql = "UPDATE questions SET number=?, level=?, statement=?, answer=? WHERE id=?"; + try (PreparedStatement pstmt = connect.prepareStatement(sql)) { + pstmt.setInt(1, obj.getNumber()); + pstmt.setInt(2, obj.getLevel()); + pstmt.setString(3, obj.getStatement()); + pstmt.setString(4, obj.getAnswer()); + pstmt.setInt(4, obj.getId()); + pstmt.executeUpdate(); + } catch (SQLException ex) { + throw new RuntimeException("Update impossible dans la table questions"); + } + } + + @Override + public Collection all() { + Collection list = new ArrayList<>(); + String sql = "SELECT * FROM questions"; + try (PreparedStatement pstmt = connect.prepareStatement(sql)) { + ResultSet rs =pstmt.executeQuery(); + while (rs.next()) { + list.add(createBean(rs)); + } + } catch (SQLException ex) { + System.out.println("Récupération impossible de la table questions"); + } + return list; + } + +} diff --git a/src/main/java/gui/QuestionsGui.java b/src/main/java/gui/QuestionsGui.java new file mode 100644 index 0000000..42158d2 --- /dev/null +++ b/src/main/java/gui/QuestionsGui.java @@ -0,0 +1,70 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package gui; + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.BorderFactory; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +/** + * + * @author CLément GROSSELLE + */ +public class QuestionsGui extends JPanel { + JPanel questionsPane, statmentPane, answerPane, buttonsPane; + JLabel sLabel, aLabel; + JTextField atf; + JButton confirmButton, showButton, nextButton; + + public QuestionsGui() { + questionsPane = new JPanel(); + statmentPane = new JPanel(); + answerPane = new JPanel(); + buttonsPane = new JPanel(); + confirmButton = new JButton("Valider réponse"); + showButton = new JButton("Afficher réponse"); + nextButton = new JButton("Question suivante"); + sLabel = new JLabel("Ici la question"); + aLabel = new JLabel("Saisissez votre réponse"); + atf = new JTextField(30); + initGui(); + initEvent(); + } + + private void initGui() { + this.setBorder(BorderFactory.createLineBorder(Color.red)); + questionsPane.setLayout(new BoxLayout(questionsPane, BoxLayout.Y_AXIS)); + answerPane.setLayout(new BoxLayout(answerPane, BoxLayout.Y_AXIS)); + statmentPane.setBorder(BorderFactory.createLineBorder(Color.yellow)); + answerPane.setBorder(BorderFactory.createLineBorder(Color.green)); + buttonsPane.setBorder(BorderFactory.createLineBorder(Color.blue)); + statmentPane.add(sLabel); + answerPane.add(aLabel); + answerPane.add(atf); + buttonsPane.add(confirmButton); + buttonsPane.add(showButton); + buttonsPane.add(nextButton); + questionsPane.add(statmentPane); + questionsPane.add(answerPane); + questionsPane.add(buttonsPane); + this.add(questionsPane); + + } + + private void initEvent() { + confirmButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ae) { + System.out.println("bouton validé"); + } + }); + } +} diff --git a/src/main/java/sql/MariaDbConnection.java b/src/main/java/sql/MariaDbConnection.java new file mode 100644 index 0000000..736e7f2 --- /dev/null +++ b/src/main/java/sql/MariaDbConnection.java @@ -0,0 +1,77 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package sql; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author Clément GROSSELLE + */ +public class MariaDbConnection { + + private static Connection instance; + + public MariaDbConnection() { + } + + public static Connection getInstance() throws RuntimeException { + if (instance == null) { + Properties config = getConfig(); + try { + Class.forName("org.mariadb.jdbc.Driver"); + } catch (ClassNotFoundException ex) { + throw new RuntimeException("Driver introuvable"); + } + String server = config.getProperty("server"); + String port = config.getProperty("port"); + String dbname = config.getProperty("dbname"); + String url = "jdbc:mariadb://" + server + ":" + port + "/" + dbname; + try { + instance = DriverManager.getConnection(url, config); + } catch (SQLException ex) { + throw new RuntimeException("Connection à la base de donnée impossible\t Message:" + ex.getMessage()); + } + } + return instance; + } + + private static Properties getConfig() { + Properties config = new Properties(); + try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("db.properties")) { + config.load(is); + } catch (FileNotFoundException ex) { + throw new RuntimeException("Fichier de paramétrage inexistant"); + } catch (IOException ex) { + throw new RuntimeException("Fichier de paramétrage illisible"); + } + return config; + } + + public static void closeConnection() { + if (instance != null) { + try { + instance.close(); + } catch (SQLException ex) { + Logger.getLogger(MariaDbConnection.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + + public static void main(String[] args) { + getInstance(); + closeConnection(); + + } + +} diff --git a/src/test/java/dao/DaoQuestionTest.java b/src/test/java/dao/DaoQuestionTest.java new file mode 100644 index 0000000..4747cb5 --- /dev/null +++ b/src/test/java/dao/DaoQuestionTest.java @@ -0,0 +1,56 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package dao; + +import beans.Question; +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; + +/** + * + * @author CLément GROSSELLE + */ +public class DaoQuestionTest { + + public DaoQuestionTest() { + } + + @Test + public void testAllCrudMethods() { + DaoQuestion daoq = new DaoQuestion(); + Question q = new Question(); + + System.out.println("Test de la méthode find"); + assertDoesNotThrow(() -> daoq.find(1)); + assertNotNull(daoq.find(1)); + assertNull(daoq.find(0)); + + System.out.println("Test de la méthode create"); + q.setStatement("test"); + q.setLevel(100); + assertDoesNotThrow(() -> daoq.create(q)); + assertNotNull(q.getId()); + + System.out.println("Test de la méthode update"); + q.setStatement("pouet"); + q.setLevel(50); + assertDoesNotThrow(() -> daoq.update(q)); + assertEquals("pouet", daoq.find(q.getId()).getStatement()); + assertEquals("50", daoq.find(q.getId()).getLevel()); + + System.out.println("Test de la méthode delete"); + assertDoesNotThrow(() -> daoq.delete(q.getId())); + assertNull(daoq.find(q.getId())); + } + + @Test + public void testAll() { + DaoQuestion daoq =new DaoQuestion(); + System.out.println("Test de la méthode all"); + assertDoesNotThrow(() -> daoq.all()); + assertEquals(daoq.all().size(), 1); + } + +} diff --git a/target/classes/beans/Drawing$DrawArea$1.class b/target/classes/beans/Drawing$DrawArea$1.class index aab4a789bc4bb9af8738a9261368f6a92a95c755..8010ec4c6b24722ecab7f797fdc34d6c9bd03767 100644 GIT binary patch delta 35 qcmeC@?C0FDoS89V@(Si!!Dt3mXr?i+GNdzbF=R4`Gh{KSGvqK>GZZjHG88ftGZZsaF_bVg PF_bcNF_ca2U@Zaw-^C99 delta 59 zcmeyx{fm3UBo@Y^$&*>mXqGatGL$iJF;p;!GgLCDGgLEJGt@CeGSo8^Gc+(%F*GtX PF*GrBF*Hx^U@Zaw@>vh5 diff --git a/target/classes/beans/Drawing$DrawArea.class b/target/classes/beans/Drawing$DrawArea.class index bc680f548466c89767dc8482fb959d77c57556a6..5e2bf9fe2cd9e743b7059600e9060f33ca01913d 100644 GIT binary patch delta 1045 zcmaDT_)LiF)W2Q(7#J9A876Mzn#;(>&Y;A|ATjZrSd@w}7lR^$2p0nrgDMY$8iP6` zgGgdZigSK$L4ICpUWrd;aY<@kY7rxYs)kQiVp*boVtI*vYFTPti9UuRYt1l_L7F@a zS`6BgH!^Cn>GCk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z{{22lm89351b8>=GlS>#G*fl&oJv}wUI2l|Rf_NB$89W#nSe<+voxQmj^cg~V z7{VCBCug&$vPJSRL@`89p2nie9m^2M&JfSTkid{Q`523`ek?;W4?_w=A|nG^Mrvky zMhVETX*>++3_Oes>_w>siJ5sNTnroxnLG?x4B3+Z}@_85v7z#K0v)V8+ zwoL9}(_!qGypzq)R-HkEfq{Vu6aZklh#?V77lUX40R~nEHUp1_sT^>g*cz8^P+!7#JAD7+4t?7*ZKH8PXW|7}6P}8HyM*7+M+185kIN z7#Kl17%CVl!Ro6Rs-dRMW?*GtW?*1&)zXrd*~Xx_l|fZYYYT(wHU`ZD4EkFc47Ii} z7;a)P-NazMjlmwmao)z@31TrbOV`V6WAFvBH!%cmWAH?{Mvj4?#F_%}`e{Ft~yO8thV6P$)AnF)%XJfZY!AcNPOHSk3@q zo%1$^5Unls42I0iTH6>RwlKs%s3c?ug=lSKNJTgb5=4_3xEQ7|C^AfC&}Nv%pwBQJ z>=;N889*Jw0*XIq5G6qaTvAJWJ3|I2aE>wXYlCQJ=6c3$3_0N-8<-hDks!pt!oa`) z3e-6aJPdOgBpBv{O&0@4nIzP71_nunT826XMuvI@1_ovZMhOOHh6ZrVG%_@S>1Kvj i1_lNt1{MY;hGvE~1||kU1_+RXPz>!1W(=K7ESvxxDwU-G diff --git a/target/classes/beans/Drawing.class b/target/classes/beans/Drawing.class index 2d5c035e5297ff58be8442112dff9ea4e8db5288..8446deb921d5b3066c847610903ca43ed4a29d4f 100644 GIT binary patch delta 1772 zcmaE-zF&sx)W2Q(7#J9A8P0Cx;$;dI&Ppsxtk5qm&&*5L_i`#NDap^{V6bLnV0X?h z%}FgS;$pC1u;pQ3WsnE4?0Fa*7#tZHc#2a?-13u4ixZP_QW+UoG@>-agcukYoOu{r z7+fdEGP`qFFu3zDcrbWQUc+qd>CMQ%P1n4DUqP?BF-BE-PR;LOh8$H;){fZ&|W zl++?F2498%kez{y3~U;no}QXvAfaF$hLFh(EK;Gq3}HMB;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8W!4Sfr$q>q5$PmV0 z!Vtk=!4S#d$`Hj6#t_XA#}Etlm z!obX60he`UkYsoYmJMUzV0Z?WWnhSh1_~%BSQwa0>NN$JK=~UQ40#Mp;II?b0)@jY z26mR^3@n%tz{kMMz`&r-Ai!Y2Ai`h>b{iznMWN<1Fo-g|WOxM)ba4hIA9e=5|Dg2E z&cMgc@S1^%oq>;0fT|kKf0$Zd2Q3SV$ z6P&mh85kHi8D28HXJ8Uw0+o7DLv0us!9L;u#n(25Q)p(^Gbn=%g}9yrZYT%D^#V+w z;uLC>CDbTZt!)fv(ad3xM>2*LZVW5L7zP%GPawZDd}jCpPJ_%08Vp|9k?K)`nh#VEum J!YIZd2>_v?{u}@R diff --git a/target/classes/com/mycompany/groupe_05/Groupe_05.class b/target/classes/com/mycompany/groupe_05/Groupe_05.class index c9e5944b6eb377556cd6227f25cdd9a55597c646..85b062eacd096a1801ddafe4aa55409b6b963478 100644 GIT binary patch delta 553 zcmaFKyo!zM)W2Q(7#J9A84M?KnJ_9&+$d2Wl3HBiR+N~V%EiFWz|79T&B(x)l$w}V ztRGmKT3nKupU1_(1(M)nWZ+Lp%-45G%ty%ZGB9&7@G=PUFbFXSGcvHGW#*+YG6-vU zYWkoWV$I1Q${@zhAkM=e!63=VAdr<VqWFMeIgSpX6Z8)GBOCDJDHJzB_%PxkdZ;q z2hHP?H5irZ6&RQpK!AyXk%5(gje(ItiGhJZpMjBqk%57MRcku~<3+&&A=YHoq;oaHv?DXb_O1w-3+{u z+Zp(Mby&7B2>5Jb5YgTi&LD*_UW$PYY!n9r7lQx;H-iKND4=*5R2ldgKvpV1jAhVd h&|+X<5MU5v&}PtKU}TVB;A7Bb&|?7kK_Bc`0{|Y1ZHoW^ delta 236 zcmZ3*_L7$?;smS^Urb1|?pFtamoPqdMqoWQtP zj0Ggl$iVM|qH3}clTtkw0}}%XFflMPurjbQFf#BkFfiydFfuSQFfg!cZD(NI$iTqB z#K6nI0G4K8U}fNAU|`^ZC}7}c5MW?n;A9YF5Q1uUWMBdt%DJ0?J#sq(rw_sah;1AU i91NUbL&OvyDj9?sL>L$tI2afiL>a`umWzXJl>h*AG#vr} diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index a601528..727e297 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,5 +1,14 @@ beans/Drawing$DrawArea$1.class +com/mycompany/groupe_05/TestFrame.class +dao/Dao.class +beans/Drawing$DrawArea$2.class +gui/QuestionsGui.class beans/Drawing$DrawArea.class +gui/QuestionsGui$1.class +beans/Drawing$1.class +sql/MariaDbConnection.class +beans/Question.class beans/Drawing.class com/mycompany/groupe_05/Groupe_05.class -beans/Drawing$DrawArea$2.class +dao/DaoQuestion.class +beans/Drawing$DrawArea$3.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index db64fcc..2de4cb1 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,2 +1,8 @@ -/home/stag/Documents/07 - Java JSE/projet/Groupe_05/src/main/java/com/mycompany/groupe_05/Groupe_05.java -/home/stag/Documents/07 - Java JSE/projet/Groupe_05/src/main/java/beans/Drawing.java +/home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/sql/MariaDbConnection.java +/home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/beans/Question.java +/home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/com/mycompany/groupe_05/TestFrame.java +/home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/dao/Dao.java +/home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/dao/DaoQuestion.java +/home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/gui/QuestionsGui.java +/home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/beans/Drawing.java +/home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/com/mycompany/groupe_05/Groupe_05.java -- GitLab From 07b8fbfdaac8a50a1521ebb7e886a90eecf7e12b Mon Sep 17 00:00:00 2001 From: Clement Date: Wed, 18 Sep 2024 16:08:47 +0200 Subject: [PATCH 03/10] + gitignore --- .gitignore | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fc0db2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,238 @@ +# Created by https://www.toptal.com/developers/gitignore/api/java,netbeans,maven,eclipse,intellij +# Edit at https://www.toptal.com/developers/gitignore?templates=java,netbeans,maven,eclipse,intellij + +### Eclipse ### +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ +.apt_generated_test/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +# Uncomment this line if you wish to ignore the project description file. +# Typically, this file would be tracked if it contains build/dependency configurations: +#.project + +### Eclipse Patch ### +# Spring Boot Tooling +.sts4-cache/ + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij +.idea/**/azureSettings.xml + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +### Maven ### +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +### NetBeans ### +**/nbproject/private/ +**/nbproject/Makefile-*.mk +**/nbproject/Package-*.bash +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +# End of https://www.toptal.com/developers/gitignore/api/java,netbeans,maven,eclipse,intellij -- GitLab From 510924dcb51f37af53d0f03cbb9abb1847e7231c Mon Sep 17 00:00:00 2001 From: Clement Date: Wed, 18 Sep 2024 17:14:46 +0200 Subject: [PATCH 04/10] =?UTF-8?q?tests=20valid=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/beans/Question.java | 12 +----------- src/main/java/dao/DaoQuestion.java | 26 ++++++++++++-------------- src/test/java/dao/DaoQuestionTest.java | 5 ++++- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/main/java/beans/Question.java b/src/main/java/beans/Question.java index 2d5f01b..4ebb82e 100644 --- a/src/main/java/beans/Question.java +++ b/src/main/java/beans/Question.java @@ -10,22 +10,13 @@ package beans; */ public class Question { private int id; - private int number; private int level; private String statement; private String answer; public Question() { } - - public int getNumber() { - return number; - } - - public void setNumber(int number) { - this.number = number; - } - + public void setId(int id) { this.id = id; } @@ -63,7 +54,6 @@ public class Question { StringBuilder sb = new StringBuilder(); sb.append("Questions{"); sb.append("id=").append(id); - sb.append(", number=").append(number); sb.append(", level=").append(level); sb.append(", statement=").append(statement); sb.append(", answer=").append(answer); diff --git a/src/main/java/dao/DaoQuestion.java b/src/main/java/dao/DaoQuestion.java index 608ed64..51f7d2b 100644 --- a/src/main/java/dao/DaoQuestion.java +++ b/src/main/java/dao/DaoQuestion.java @@ -24,12 +24,11 @@ public class DaoQuestion implements Dao { private Question createBean(ResultSet rs) { Question obj = new Question(); try { - obj.setNumber(rs.getInt("number")); obj.setLevel(rs.getInt("level")); obj.setStatement(rs.getString("statement")); obj.setAnswer(rs.getString("answer")); } catch (SQLException ex) { - System.out.println("Impossible de parcourir le resultSet"); + System.out.println("Impossible de parcourir le resultSet" + ex.getMessage()); } return obj; } @@ -40,12 +39,12 @@ public class DaoQuestion implements Dao { String sql = "SELECT * FROM questions WHERE id=?"; try (PreparedStatement pstmt = connect.prepareStatement(sql)) { pstmt.setInt(1, id); - ResultSet rs = pstmt.executeQuery(sql); + ResultSet rs = pstmt.executeQuery(); if (rs.next()) { q = createBean(rs); } } catch (SQLException ex) { - throw new RuntimeException("Recherche impossible dans la table questions"); + throw new RuntimeException("Recherche impossible dans la table questions" + ex.getMessage()); } return q; } @@ -63,7 +62,7 @@ public class DaoQuestion implements Dao { obj.setId(keys.getInt(1)); } } catch (SQLException ex) { - throw new RuntimeException("Insertion impossible dans la table questions"); + throw new RuntimeException("Insertion impossible dans la table questions\t Message: " + ex.getMessage()); } } @@ -74,22 +73,21 @@ public class DaoQuestion implements Dao { pstmt.setInt(1, id); pstmt.executeUpdate(); } catch (SQLException ex) { - throw new RuntimeException("Suppression impossible dans la table questions"); + throw new RuntimeException("Suppression impossible dans la table questions" + ex.getMessage()); } } @Override public void update(Question obj) { - String sql = "UPDATE questions SET number=?, level=?, statement=?, answer=? WHERE id=?"; + String sql = "UPDATE questions SET level=?, statement=?, answer=? WHERE id=?"; try (PreparedStatement pstmt = connect.prepareStatement(sql)) { - pstmt.setInt(1, obj.getNumber()); - pstmt.setInt(2, obj.getLevel()); - pstmt.setString(3, obj.getStatement()); - pstmt.setString(4, obj.getAnswer()); + pstmt.setInt(1, obj.getLevel()); + pstmt.setString(2, obj.getStatement()); + pstmt.setString(3, obj.getAnswer()); pstmt.setInt(4, obj.getId()); pstmt.executeUpdate(); } catch (SQLException ex) { - throw new RuntimeException("Update impossible dans la table questions"); + throw new RuntimeException("Update impossible dans la table questions" + ex.getMessage()); } } @@ -98,12 +96,12 @@ public class DaoQuestion implements Dao { Collection list = new ArrayList<>(); String sql = "SELECT * FROM questions"; try (PreparedStatement pstmt = connect.prepareStatement(sql)) { - ResultSet rs =pstmt.executeQuery(); + ResultSet rs = pstmt.executeQuery(); while (rs.next()) { list.add(createBean(rs)); } } catch (SQLException ex) { - System.out.println("Récupération impossible de la table questions"); + System.out.println("Récupération impossible de la table questions" + ex.getMessage()); } return list; } diff --git a/src/test/java/dao/DaoQuestionTest.java b/src/test/java/dao/DaoQuestionTest.java index 4747cb5..1ddd5e6 100644 --- a/src/test/java/dao/DaoQuestionTest.java +++ b/src/test/java/dao/DaoQuestionTest.java @@ -29,16 +29,19 @@ public class DaoQuestionTest { System.out.println("Test de la méthode create"); q.setStatement("test"); + q.setAnswer("test"); q.setLevel(100); assertDoesNotThrow(() -> daoq.create(q)); assertNotNull(q.getId()); System.out.println("Test de la méthode update"); q.setStatement("pouet"); + q.setAnswer("pouet"); q.setLevel(50); assertDoesNotThrow(() -> daoq.update(q)); assertEquals("pouet", daoq.find(q.getId()).getStatement()); - assertEquals("50", daoq.find(q.getId()).getLevel()); + assertEquals("pouet", daoq.find(q.getId()).getAnswer()); + assertEquals(50, daoq.find(q.getId()).getLevel()); System.out.println("Test de la méthode delete"); assertDoesNotThrow(() -> daoq.delete(q.getId())); -- GitLab From 6243e972030121793609897a2c3b29fc897a33f8 Mon Sep 17 00:00:00 2001 From: Clement Date: Wed, 18 Sep 2024 19:06:07 +0200 Subject: [PATCH 05/10] evenementiel questions --- src/main/java/beans/Question.java | 24 +++- .../com/mycompany/groupe_05/Groupe_05.java | 2 +- src/main/java/gui/QuestionsGui.java | 106 ++++++++++++++++-- .../com/mycompany/groupe_05/Groupe_05.class | Bin 810 -> 668 bytes .../compile/default-compile/createdFiles.lst | 2 + 5 files changed, 120 insertions(+), 14 deletions(-) diff --git a/src/main/java/beans/Question.java b/src/main/java/beans/Question.java index 4ebb82e..80759c1 100644 --- a/src/main/java/beans/Question.java +++ b/src/main/java/beans/Question.java @@ -4,11 +4,15 @@ */ package beans; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Random; + /** * * @author Clément GROSSELLE */ -public class Question { +public class Question implements Serializable { private int id; private int level; private String statement; @@ -17,6 +21,13 @@ public class Question { public Question() { } + public Question(Question q) { + this.id = q.id; + this.level = q.level; + this.statement = q.statement; + this.answer = q.answer; + } + public void setId(int id) { this.id = id; } @@ -61,7 +72,12 @@ public class Question { return sb.toString(); } - - - +// public Question selectRandomQuestion(ArrayList qlist) { +// Random randGen = new Random(); +// Question q = new Question(); +// int rand = randGen.nextInt(qlist.size()); +// return qlist.get(rand); +// } +// +// } diff --git a/src/main/java/com/mycompany/groupe_05/Groupe_05.java b/src/main/java/com/mycompany/groupe_05/Groupe_05.java index 1efa59c..6fcd55d 100644 --- a/src/main/java/com/mycompany/groupe_05/Groupe_05.java +++ b/src/main/java/com/mycompany/groupe_05/Groupe_05.java @@ -10,7 +10,7 @@ public class Groupe_05 { Question q = new Question(); DaoQuestion daoq = new DaoQuestion(); q = daoq.find(1); - System.out.println(q); + //System.out.println(q); } diff --git a/src/main/java/gui/QuestionsGui.java b/src/main/java/gui/QuestionsGui.java index 42158d2..11aba1d 100644 --- a/src/main/java/gui/QuestionsGui.java +++ b/src/main/java/gui/QuestionsGui.java @@ -4,9 +4,16 @@ */ package gui; +import beans.Question; +import dao.DaoQuestion; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.Serializable; +import java.text.Normalizer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Random; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; @@ -16,55 +23,136 @@ import javax.swing.JTextField; /** * - * @author CLément GROSSELLE + * @author Clément GROSSELLE */ -public class QuestionsGui extends JPanel { - JPanel questionsPane, statmentPane, answerPane, buttonsPane; - JLabel sLabel, aLabel; +public class QuestionsGui extends JPanel implements Serializable{ + + private static final long serialVersionUID = 1L; + + JPanel questionsPane, statmentPane, helpPane, answerPane, buttonsPane; + JLabel sLabel, aLabel, hLabel; JTextField atf; JButton confirmButton, showButton, nextButton; - + Question q = new Question(); + Collection qlist = new ArrayList<>(); + public QuestionsGui() { + qlist = initQuestion(); + System.out.println("qlist: " + qlist); + q = selectRandomQuestion((ArrayList) qlist); questionsPane = new JPanel(); statmentPane = new JPanel(); + helpPane = new JPanel(); answerPane = new JPanel(); buttonsPane = new JPanel(); confirmButton = new JButton("Valider réponse"); showButton = new JButton("Afficher réponse"); nextButton = new JButton("Question suivante"); - sLabel = new JLabel("Ici la question"); + sLabel = new JLabel(q.getStatement()); + hLabel = new JLabel("blabla"); aLabel = new JLabel("Saisissez votre réponse"); atf = new JTextField(30); initGui(); initEvent(); + System.out.println("q: " + q); + System.out.println("lab: " + sLabel.getText()); + System.out.println("qlist: " + qlist); } - + private void initGui() { + // Design this.setBorder(BorderFactory.createLineBorder(Color.red)); questionsPane.setLayout(new BoxLayout(questionsPane, BoxLayout.Y_AXIS)); answerPane.setLayout(new BoxLayout(answerPane, BoxLayout.Y_AXIS)); statmentPane.setBorder(BorderFactory.createLineBorder(Color.yellow)); answerPane.setBorder(BorderFactory.createLineBorder(Color.green)); buttonsPane.setBorder(BorderFactory.createLineBorder(Color.blue)); + + //Ajout des composants + //Question statmentPane.add(sLabel); + //Aide + helpPane.add(hLabel); + //Saisie utilisateur answerPane.add(aLabel); answerPane.add(atf); + //Boutons buttonsPane.add(confirmButton); buttonsPane.add(showButton); buttonsPane.add(nextButton); + + // Panneau principal de l'activité questionsPane.add(statmentPane); + questionsPane.add(helpPane); questionsPane.add(answerPane); questionsPane.add(buttonsPane); - this.add(questionsPane); + // Pas sur pour ça + this.add(questionsPane); + } private void initEvent() { confirmButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { - System.out.println("bouton validé"); + String usrTxt = atf.getText().toLowerCase(); + String answer = q.getAnswer().toLowerCase(); + System.out.println("bouton validé\nTexte saisi: " + usrTxt); + usrTxt = removeAccents(usrTxt); + System.out.println("Après traitement: " + usrTxt); + if (usrTxt.equals(answer)) { + //Pop-up validé + System.out.println("oui"); + + } else { + System.out.println("nop"); + } + } + }); + showButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ae) { + System.out.println("bouton afficher"); + } + }); + nextButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ae) { + System.out.println("bouton suivant"); + if (!qlist.isEmpty()) { + q = selectRandomQuestion((ArrayList) qlist); + sLabel.setText(q.getStatement()); + } else { + // Ici pop-up d'erreur qui prend le focus + } } }); } + + private Collection initQuestion() { + DaoQuestion daoq = new DaoQuestion(); + return daoq.all(); + } + + private Question selectRandomQuestion(ArrayList qlist) { + Random randGen = new Random(); + //Question q = new Question(); + int rand = randGen.nextInt(qlist.size()); + q = qlist.get(rand); + try { + qlist.remove(rand); + } catch (IllegalArgumentException iae) { + throw new IllegalArgumentException("La liste des question est vide"); + } + return q; + } + + public String removeAccents(String text) { + if (text== null) + return null; + String replaceAll = Normalizer.normalize(text, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); + return replaceAll; + } + } diff --git a/target/classes/com/mycompany/groupe_05/Groupe_05.class b/target/classes/com/mycompany/groupe_05/Groupe_05.class index 85b062eacd096a1801ddafe4aa55409b6b963478..78dca1628b6f5d3929f5e096eb60e2bce3725a62 100644 GIT binary patch delta 208 zcmZ3*Hiwn#)W2Q(7#J9A8B`~7ZDnR>5S?fvJvo8#ON0($ps>Gi!rc*RdO(JF$gelGe|J-Fvv0RGk{D}faqY5WsqZFU=U#7XOL%5 WU|?jBU|?rZWKd!NIZqkv4ix|;HxbGJ delta 354 zcmbQkx{8hK)W2Q(7#J9A84M?KZLQ~I5M>Z!XAtLMkYJExWDv+oEKAhSNz6;v53VdO zNzG+sV9qZsVPp{X0n23O>jxBN=9L7O6s0EST5~Z-Gsv(r$nr4AF~~DA2xC#h$iQ9z z(vg$L$RMf#F$HYCe^ORzGFOSUW*9qzA|r$1WO+u#iO*igC@?TFfB+K%BLgb~8v`SQ z5(5K+J_92IBLf2itJZb~#*GXN3``8l3=Cjt5UIkzz`z4hz@W;Y#=yY9$)L`l0o7c= zz{J4Jz`&q3S(iyJW)p*m_BIA7gdtK4Y+wx>3|tHX4BQM73?TpTGN>}}Gk^?MfM{mW iWYA(@U=UysW6);MVPIsCVBllWWzb^)xl|wQBm)3^8aL|z diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 727e297..29a1d2b 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -2,6 +2,7 @@ beans/Drawing$DrawArea$1.class com/mycompany/groupe_05/TestFrame.class dao/Dao.class beans/Drawing$DrawArea$2.class +gui/QuestionsGui$2.class gui/QuestionsGui.class beans/Drawing$DrawArea.class gui/QuestionsGui$1.class @@ -11,4 +12,5 @@ beans/Question.class beans/Drawing.class com/mycompany/groupe_05/Groupe_05.class dao/DaoQuestion.class +gui/QuestionsGui$3.class beans/Drawing$DrawArea$3.class -- GitLab From 142f0ef891d157bbb6bca355797281b3c9426b0c Mon Sep 17 00:00:00 2001 From: Clement Date: Thu, 19 Sep 2024 11:16:26 +0200 Subject: [PATCH 06/10] =?UTF-8?q?activit=C3=A9=20question=20~ok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/beans/Question.java | 9 - .../com/mycompany/groupe_05/TestFrame.java | 2 +- src/main/java/gui/QuestionsGui.java | 161 ++++++++++++------ src/main/resources/db.sql | 17 +- src/test/java/dao/DaoQuestionTest.java | 2 +- .../compile/default-compile/createdFiles.lst | 2 - 6 files changed, 123 insertions(+), 70 deletions(-) diff --git a/src/main/java/beans/Question.java b/src/main/java/beans/Question.java index 80759c1..0372ce9 100644 --- a/src/main/java/beans/Question.java +++ b/src/main/java/beans/Question.java @@ -71,13 +71,4 @@ public class Question implements Serializable { sb.append('}'); return sb.toString(); } - -// public Question selectRandomQuestion(ArrayList qlist) { -// Random randGen = new Random(); -// Question q = new Question(); -// int rand = randGen.nextInt(qlist.size()); -// return qlist.get(rand); -// } -// -// } diff --git a/src/main/java/com/mycompany/groupe_05/TestFrame.java b/src/main/java/com/mycompany/groupe_05/TestFrame.java index fd559ce..caca067 100644 --- a/src/main/java/com/mycompany/groupe_05/TestFrame.java +++ b/src/main/java/com/mycompany/groupe_05/TestFrame.java @@ -20,7 +20,7 @@ public class TestFrame extends JFrame { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setResizable(true); this.pack(); - //this.setSize(300, 500); + //this.setSize(600, 600); this.setLocationRelativeTo(null); this.setVisible(true); } diff --git a/src/main/java/gui/QuestionsGui.java b/src/main/java/gui/QuestionsGui.java index 11aba1d..00d62d9 100644 --- a/src/main/java/gui/QuestionsGui.java +++ b/src/main/java/gui/QuestionsGui.java @@ -6,26 +6,28 @@ package gui; import beans.Question; import dao.DaoQuestion; -import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.Serializable; import java.text.Normalizer; import java.util.ArrayList; import java.util.Collection; import java.util.Random; +import javax.swing.AbstractAction; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; +import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.KeyStroke; /** * * @author Clément GROSSELLE */ -public class QuestionsGui extends JPanel implements Serializable{ +public class QuestionsGui extends JPanel { private static final long serialVersionUID = 1L; @@ -35,97 +37,139 @@ public class QuestionsGui extends JPanel implements Serializable{ JButton confirmButton, showButton, nextButton; Question q = new Question(); Collection qlist = new ArrayList<>(); + Font labelFont = new Font(Font.SANS_SERIF, Font.BOLD, 20); + Font helpFont = new Font(Font.SANS_SERIF, Font.ITALIC, 12); + Font buttonFont = new Font(Font.SANS_SERIF, Font.PLAIN, 15); + Font textFieldFont = new Font(Font.SANS_SERIF, Font.PLAIN, 20); public QuestionsGui() { qlist = initQuestion(); - System.out.println("qlist: " + qlist); + //System.out.println("qlist: " + qlist); q = selectRandomQuestion((ArrayList) qlist); + + // Initialisation des panneaux et composants questionsPane = new JPanel(); statmentPane = new JPanel(); helpPane = new JPanel(); answerPane = new JPanel(); buttonsPane = new JPanel(); + confirmButton = new JButton("Valider réponse"); showButton = new JButton("Afficher réponse"); nextButton = new JButton("Question suivante"); - sLabel = new JLabel(q.getStatement()); - hLabel = new JLabel("blabla"); - aLabel = new JLabel("Saisissez votre réponse"); - atf = new JTextField(30); + + // Config labels: + // Question + sLabel = new JLabel("" + q.getStatement() + ""); + sLabel.setFont(labelFont); + sLabel.setHorizontalAlignment(JLabel.CENTER); + + // Aide + hLabel = new JLabel(" ", JLabel.CENTER); + hLabel.setFont(helpFont); + hLabel.setHorizontalAlignment(JLabel.CENTER); + + // Réponse + aLabel = new JLabel("Saisissez votre réponse", JLabel.CENTER); + aLabel.setFont(helpFont); + aLabel.setHorizontalAlignment(JLabel.CENTER); + + atf = new JTextField(); + + // Paramétrage des dfférentes font + confirmButton.setFont(buttonFont); + showButton.setFont(buttonFont); + nextButton.setFont(buttonFont); + atf.setFont(textFieldFont); + initGui(); initEvent(); - System.out.println("q: " + q); - System.out.println("lab: " + sLabel.getText()); - System.out.println("qlist: " + qlist); + } private void initGui() { - // Design - this.setBorder(BorderFactory.createLineBorder(Color.red)); + // Layout questionsPane.setLayout(new BoxLayout(questionsPane, BoxLayout.Y_AXIS)); answerPane.setLayout(new BoxLayout(answerPane, BoxLayout.Y_AXIS)); - statmentPane.setBorder(BorderFactory.createLineBorder(Color.yellow)); - answerPane.setBorder(BorderFactory.createLineBorder(Color.green)); - buttonsPane.setBorder(BorderFactory.createLineBorder(Color.blue)); - + + //Size + //questionsPane.setPreferredSize(new Dimension(600, 600)); + statmentPane.setPreferredSize(new Dimension(300, 50)); + helpPane.setPreferredSize(new Dimension(200, 50)); + //answerPane.setPreferredSize(new Dimension(50, 20)); + //buttonsPane.setPreferredSize(new Dimension(600, 150)); + + //Border + questionsPane.setBorder(BorderFactory.createEmptyBorder(30, 10, 10, 10)); + //this.setBorder(BorderFactory.createLineBorder(Color.green)); + //questionsPane.setBorder(BorderFactory.createLineBorder(Color.green)); + //statmentPane.setBorder(BorderFactory.createLineBorder(Color.yellow)); + //answerPane.setBorder(BorderFactory.createLineBorder(Color.green)); + //buttonsPane.setBorder(BorderFactory.createLineBorder(Color.blue)); + //Ajout des composants - //Question + //Question statmentPane.add(sLabel); - //Aide + //Aide helpPane.add(hLabel); - //Saisie utilisateur + //Saisie utilisateur answerPane.add(aLabel); answerPane.add(atf); - //Boutons + //Boutons buttonsPane.add(confirmButton); buttonsPane.add(showButton); buttonsPane.add(nextButton); - + // Panneau principal de l'activité questionsPane.add(statmentPane); questionsPane.add(helpPane); questionsPane.add(answerPane); questionsPane.add(buttonsPane); - + // Pas sur pour ça this.add(questionsPane); - } private void initEvent() { - confirmButton.addActionListener(new ActionListener() { + // Méthode validation réponse, clic confirmButton ou Enter + AbstractAction confirmAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent ae) { - String usrTxt = atf.getText().toLowerCase(); - String answer = q.getAnswer().toLowerCase(); - System.out.println("bouton validé\nTexte saisi: " + usrTxt); - usrTxt = removeAccents(usrTxt); - System.out.println("Après traitement: " + usrTxt); - if (usrTxt.equals(answer)) { + if (compareStrings(atf.getText(), q.getAnswer())) { //Pop-up validé System.out.println("oui"); - + hLabel.setText("Bravo, tu as trouvé la bonne réponse!"); + changeQuestion(); + atf.setText(""); } else { System.out.println("nop"); + hLabel.setText("Oh non c'est raté! Essaye encore."); } } + }; + //Association au boutton confirm + confirmButton.addActionListener(confirmAction); + // Et à la touche entrée + atf.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "confirm"); + atf.getActionMap().put("confirm", confirmAction); + + // Clic boutton afficher réponse + showButton.addActionListener((ActionEvent ae) -> { + System.out.println("bouton afficher"); + hLabel.setText("La réponse attendue est :\n " + q.getAnswer()); }); - showButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent ae) { - System.out.println("bouton afficher"); - } - }); - nextButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent ae) { - System.out.println("bouton suivant"); - if (!qlist.isEmpty()) { - q = selectRandomQuestion((ArrayList) qlist); - sLabel.setText(q.getStatement()); - } else { - // Ici pop-up d'erreur qui prend le focus - } + + // Clic bouton suivant + nextButton.addActionListener((ActionEvent ae) -> { + hLabel.setText(""); + System.out.println("bouton suivant\n Nombre de questions restantes:" + qlist.size()); + if (!qlist.isEmpty()) { + // Si il reste des question dans la liste, on passa a la suivante + changeQuestion(); + } else { + // Sinon on réinjecte les questions de la bdd et zérapatis + qlist = initQuestion(); + changeQuestion(); } }); } @@ -147,12 +191,25 @@ public class QuestionsGui extends JPanel implements Serializable{ } return q; } - - public String removeAccents(String text) { - if (text== null) + + private String removeAccents(String text) { + if (text == null) { return null; + } String replaceAll = Normalizer.normalize(text, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); return replaceAll; } + private boolean compareStrings(String inString, String ansString) { + inString = inString.toLowerCase(); + ansString = ansString.toLowerCase(); + inString = removeAccents(inString); + return inString.equals(ansString); + } + + private void changeQuestion() { + q = selectRandomQuestion((ArrayList) qlist); + sLabel.setText(q.getStatement()); + } + } diff --git a/src/main/resources/db.sql b/src/main/resources/db.sql index 904bb6e..30429e0 100644 --- a/src/main/resources/db.sql +++ b/src/main/resources/db.sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- Hôte : localhost --- Généré le : mer. 18 sep. 2024 à 10:40 +-- Généré le : jeu. 19 sep. 2024 à 09:03 -- Version du serveur : 10.1.48-MariaDB-0+deb9u2 -- Version de PHP : 7.4.33 @@ -30,7 +30,6 @@ SET time_zone = "+00:00"; CREATE TABLE `questions` ( `id` int(11) NOT NULL, - `number` int(11) NOT NULL, `level` int(11) NOT NULL, `statement` text NOT NULL, `answer` text NOT NULL @@ -40,8 +39,16 @@ CREATE TABLE `questions` ( -- Déchargement des données de la table `questions` -- -INSERT INTO `questions` (`id`, `number`, `level`, `statement`, `answer`) VALUES -(1, 1, 1, 'Comment ça va?', 'bieng'); +INSERT INTO `questions` (`id`, `level`, `statement`, `answer`) VALUES +(1, 1, 'Combien y a-t-il de doigts sur une main?', 'Cinq'), +(2, 1, 'De quelle couleur est le ciel?', 'Bleu'), +(3, 1, 'De quelle couleur est le cheval blanc d\'Henry IV?', 'Blanc'), +(4, 1, 'Quel animal fait miaou?', 'Chat'), +(5, 1, 'De quelle couleur est une tomate bien mûre?', 'Rouge'), +(6, 1, 'Combien y a-t-il de saisons dans une année?', 'Quatre'), +(7, 1, 'Combien de côtés a un carré?', 'Quatre'), +(8, 1, 'Quelle est la couleur de l\'herbe?', 'Verte') +; -- -- Index pour les tables déchargées @@ -61,7 +68,7 @@ ALTER TABLE `questions` -- AUTO_INCREMENT pour la table `questions` -- ALTER TABLE `questions` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/src/test/java/dao/DaoQuestionTest.java b/src/test/java/dao/DaoQuestionTest.java index 1ddd5e6..323ee8b 100644 --- a/src/test/java/dao/DaoQuestionTest.java +++ b/src/test/java/dao/DaoQuestionTest.java @@ -53,7 +53,7 @@ public class DaoQuestionTest { DaoQuestion daoq =new DaoQuestion(); System.out.println("Test de la méthode all"); assertDoesNotThrow(() -> daoq.all()); - assertEquals(daoq.all().size(), 1); + assertEquals(daoq.all().size(), 8); } } diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 29a1d2b..727e297 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -2,7 +2,6 @@ beans/Drawing$DrawArea$1.class com/mycompany/groupe_05/TestFrame.class dao/Dao.class beans/Drawing$DrawArea$2.class -gui/QuestionsGui$2.class gui/QuestionsGui.class beans/Drawing$DrawArea.class gui/QuestionsGui$1.class @@ -12,5 +11,4 @@ beans/Question.class beans/Drawing.class com/mycompany/groupe_05/Groupe_05.class dao/DaoQuestion.class -gui/QuestionsGui$3.class beans/Drawing$DrawArea$3.class -- GitLab From 1444eee35e32a3248890105f25fad182f07f7490 Mon Sep 17 00:00:00 2001 From: sid Date: Thu, 19 Sep 2024 12:12:09 +0200 Subject: [PATCH 07/10] dessin final --- src/main/java/beans/Drawing.java | 110 +++++++++++++++++-------------- 1 file changed, 60 insertions(+), 50 deletions(-) diff --git a/src/main/java/beans/Drawing.java b/src/main/java/beans/Drawing.java index f296347..ab4a24b 100644 --- a/src/main/java/beans/Drawing.java +++ b/src/main/java/beans/Drawing.java @@ -1,62 +1,63 @@ package beans; - +import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.event.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; public class Drawing extends JFrame { private Color currentColor = Color.BLACK; private int brushSize = 10; private boolean eraserMode = false; + private boolean hasDrawn = false; // Indicateur pour savoir si un dessin a été effectué + private DrawArea drawArea; + private JButton saveButton; // Bouton pour enregistrer public Drawing() { setTitle("Application de Dessin"); setSize(800, 600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - // Zone de dessin drawArea = new DrawArea(); drawArea.setBackground(Color.WHITE); - // Bouton pour choisir la couleur + // Créer les boutons et options (sans icônes ni curseur personnalisé) JButton colorButton = new JButton("Couleur"); - colorButton.setFocusable(false); colorButton.addActionListener(e -> chooseColor()); - // Bouton pour effacer tout JButton eraseButton = new JButton("Effacer tout"); - eraseButton.setFocusable(false); - eraseButton.addActionListener(e -> drawArea.clear()); + eraseButton.addActionListener(e -> { + drawArea.clear(); + hasDrawn = false; // Réinitialiser le statut + saveButton.setEnabled(false); // Désactiver le bouton d'enregistrement + }); - // Slider pour choisir la taille du pinceau JSlider sizeSlider = new JSlider(1, 50, brushSize); sizeSlider.setMajorTickSpacing(10); sizeSlider.setPaintTicks(true); sizeSlider.setPaintLabels(true); - sizeSlider.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - brushSize = sizeSlider.getValue(); - } - }); + sizeSlider.addChangeListener(e -> brushSize = sizeSlider.getValue()); - // Bouton pour activer/désactiver la gomme JButton eraserButton = new JButton("Gomme"); - eraserButton.setFocusable(false); eraserButton.addActionListener(e -> eraserMode = !eraserMode); - // Disposition des éléments d'interface dans un JPanel avec un FlowLayout + // Bouton "Enregistrer" désactivé par défaut + saveButton = new JButton("Enregistrer"); + saveButton.setEnabled(false); // Désactivé par défaut + saveButton.addActionListener(e -> saveDrawing()); + + // Disposition des éléments d'interface JPanel controls = new JPanel(); - controls.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); // Espacement entre les composants controls.add(colorButton); - controls.add(new JLabel("Taille du pinceau :")); + controls.add(new JLabel("Taille du stylo :")); controls.add(sizeSlider); controls.add(eraserButton); controls.add(eraseButton); + controls.add(saveButton); // Ajout du bouton d'enregistrement // Ajouter les composants à la fenêtre add(controls, BorderLayout.NORTH); @@ -74,10 +75,33 @@ public class Drawing extends JFrame { } } - // Zone de dessin personnalisée - private class DrawArea extends JPanel { + // Méthode pour enregistrer le dessin dans un fichier + private void saveDrawing() { + if (!hasDrawn) { + JOptionPane.showMessageDialog(this, "Rien n'a été dessiné à enregistrer.", "Erreur", JOptionPane.ERROR_MESSAGE); + return; + } + + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogTitle("Enregistrer le dessin"); + int userSelection = fileChooser.showSaveDialog(this); + + if (userSelection == JFileChooser.APPROVE_OPTION) { + File fileToSave = fileChooser.getSelectedFile(); + try { + // Crée un fichier PNG + ImageIO.write(drawArea.getImage(), "png", new File(fileToSave.getAbsolutePath() + ".png")); + JOptionPane.showMessageDialog(this, "Dessin enregistré avec succès !"); + } catch (IOException ex) { + ex.printStackTrace(); + JOptionPane.showMessageDialog(this, "Erreur lors de l'enregistrement du fichier.", "Erreur", JOptionPane.ERROR_MESSAGE); + } + } + } - private Image image; + // Zone de dessin + private class DrawArea extends JPanel { + private BufferedImage image; private Graphics2D g2d; private int prevX, prevY; @@ -103,45 +127,26 @@ public class Drawing extends JFrame { int y = e.getY(); if (eraserMode) { - g2d.setColor(Color.WHITE); // Utiliser la gomme + g2d.setColor(Color.WHITE); // Mode gomme } else { - g2d.setColor(currentColor); // Utiliser la couleur sélectionnée + g2d.setColor(currentColor); // Mode pinceau } - // Dessiner un trait continu g2d.setStroke(new BasicStroke(brushSize, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); g2d.drawLine(prevX, prevY, x, y); - repaint(); prevX = x; prevY = y; - } - }); - // Redimensionner l'image lors du redimensionnement de la fenêtre - addComponentListener(new ComponentAdapter() { - @Override - public void componentResized(ComponentEvent e) { - if (g2d != null) { - Image newImage = createImage(getWidth(), getHeight()); - Graphics2D g2dNew = (Graphics2D) newImage.getGraphics(); - g2dNew.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2dNew.setColor(Color.WHITE); - g2dNew.fillRect(0, 0, getWidth(), getHeight()); - g2dNew.drawImage(image, 0, 0, null); // Copie l'ancien contenu sur la nouvelle image - g2d = g2dNew; - image = newImage; - } else { - initDrawing(getSize().width, getSize().height); - } - repaint(); + hasDrawn = true; // Marque le fait qu'un dessin a été effectué + saveButton.setEnabled(true); // Active le bouton d'enregistrement } }); } - // Méthode pour initialiser l'image de dessin + // Initialisation de l'image de dessin private void initDrawing(int width, int height) { - image = createImage(width, height); + image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); g2d = (Graphics2D) image.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(Color.WHITE); @@ -149,7 +154,7 @@ public class Drawing extends JFrame { g2d.setColor(Color.BLACK); } - // Méthode pour effacer le dessin + // Effacer tout public void clear() { g2d.setPaint(Color.WHITE); g2d.fillRect(0, 0, getSize().width, getSize().height); @@ -157,6 +162,11 @@ public class Drawing extends JFrame { repaint(); } + // Retourne l'image en cours de dessin + public BufferedImage getImage() { + return image; + } + @Override protected void paintComponent(Graphics g) { super.paintComponent(g); -- GitLab From a8e0cc7d98baa05e520e172b5a1a75341b9686a5 Mon Sep 17 00:00:00 2001 From: Clement Date: Thu, 19 Sep 2024 12:14:35 +0200 Subject: [PATCH 08/10] avant merge --- src/main/java/com/mycompany/groupe_05/Groupe_05.java | 6 ------ src/main/resources/db.sql | 9 +++++---- .../compile/default-compile/createdFiles.lst | 1 + .../compile/default-compile/inputFiles.lst | 1 + 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/mycompany/groupe_05/Groupe_05.java b/src/main/java/com/mycompany/groupe_05/Groupe_05.java index 6fcd55d..e1952cb 100644 --- a/src/main/java/com/mycompany/groupe_05/Groupe_05.java +++ b/src/main/java/com/mycompany/groupe_05/Groupe_05.java @@ -6,12 +6,6 @@ import dao.DaoQuestion; public class Groupe_05 { public static void main(String[] args) { - new TestFrame(); - Question q = new Question(); - DaoQuestion daoq = new DaoQuestion(); - q = daoq.find(1); - //System.out.println(q); - } } diff --git a/src/main/resources/db.sql b/src/main/resources/db.sql index 30429e0..a7ad42b 100644 --- a/src/main/resources/db.sql +++ b/src/main/resources/db.sql @@ -3,7 +3,7 @@ -- https://www.phpmyadmin.net/ -- -- Hôte : localhost --- Généré le : jeu. 19 sep. 2024 à 09:03 +-- Généré le : jeu. 19 sep. 2024 à 12:14 -- Version du serveur : 10.1.48-MariaDB-0+deb9u2 -- Version de PHP : 7.4.33 @@ -47,8 +47,9 @@ INSERT INTO `questions` (`id`, `level`, `statement`, `answer`) VALUES (5, 1, 'De quelle couleur est une tomate bien mûre?', 'Rouge'), (6, 1, 'Combien y a-t-il de saisons dans une année?', 'Quatre'), (7, 1, 'Combien de côtés a un carré?', 'Quatre'), -(8, 1, 'Quelle est la couleur de l\'herbe?', 'Verte') -; +(8, 1, 'Quelle est la couleur de l\'herbe?', 'Verte'), +(13, 1, 'Quel est le meilleur formateur?', 'Herbert'), +(15, 1, 'Quel est le meilleur formateur?', 'Herbert'); -- -- Index pour les tables déchargées @@ -68,7 +69,7 @@ ALTER TABLE `questions` -- AUTO_INCREMENT pour la table `questions` -- ALTER TABLE `questions` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index 727e297..96a1727 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -12,3 +12,4 @@ beans/Drawing.class com/mycompany/groupe_05/Groupe_05.class dao/DaoQuestion.class beans/Drawing$DrawArea$3.class +gui/NewQuestion.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 2de4cb1..5adef75 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -2,6 +2,7 @@ /home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/beans/Question.java /home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/com/mycompany/groupe_05/TestFrame.java /home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/dao/Dao.java +/home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/gui/NewQuestion.java /home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/dao/DaoQuestion.java /home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/gui/QuestionsGui.java /home/stag/NetBeansProjects/projet_java/projet_groupe05/src/main/java/beans/Drawing.java -- GitLab From 887c9aecb547ddc3822e1d3b372b9ff66599e9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20GROSSELLE?= Date: Thu, 19 Sep 2024 10:17:01 +0000 Subject: [PATCH 09/10] Update Groupe_05.java --- src/main/java/com/mycompany/groupe_05/Groupe_05.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/com/mycompany/groupe_05/Groupe_05.java b/src/main/java/com/mycompany/groupe_05/Groupe_05.java index e1952cb..2a77405 100644 --- a/src/main/java/com/mycompany/groupe_05/Groupe_05.java +++ b/src/main/java/com/mycompany/groupe_05/Groupe_05.java @@ -1,8 +1,5 @@ package com.mycompany.groupe_05; -import beans.Question; -import dao.DaoQuestion; - public class Groupe_05 { public static void main(String[] args) { -- GitLab From 530b9aeb49e2707952baefb8cd6c59d5dee06362 Mon Sep 17 00:00:00 2001 From: Clement Date: Thu, 19 Sep 2024 16:51:20 +0200 Subject: [PATCH 10/10] =?UTF-8?q?Impl=C3=A9mentation=20activit=C3=A9s,=20m?= =?UTF-8?q?ain=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/beans/Drawing.java | 117 +++++++++------- src/main/java/beans/Question.java | 7 +- .../com/mycompany/groupe_05/ContentFrame.java | 129 ++++++++++++++++++ .../com/mycompany/groupe_05/Groupe_05.java | 1 + .../com/mycompany/groupe_05/TestFrame.java | 2 + src/main/java/gui/MainMenu.java | 77 +++++++++++ src/main/java/gui/QuestionsGui.java | 31 ++--- target/classes/beans/Drawing$DrawArea$1.class | Bin 1167 -> 1167 bytes target/classes/beans/Drawing$DrawArea$2.class | Bin 1530 -> 1686 bytes target/classes/beans/Drawing$DrawArea.class | Bin 2406 -> 2384 bytes target/classes/beans/Drawing.class | Bin 3647 -> 5506 bytes .../com/mycompany/groupe_05/Groupe_05.class | Bin 668 -> 538 bytes .../compile/default-compile/createdFiles.lst | 4 +- .../compile/default-compile/inputFiles.lst | 19 +-- 14 files changed, 298 insertions(+), 89 deletions(-) create mode 100644 src/main/java/com/mycompany/groupe_05/ContentFrame.java create mode 100644 src/main/java/gui/MainMenu.java diff --git a/src/main/java/beans/Drawing.java b/src/main/java/beans/Drawing.java index f296347..46ea309 100644 --- a/src/main/java/beans/Drawing.java +++ b/src/main/java/beans/Drawing.java @@ -1,64 +1,66 @@ package beans; - +import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.event.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; -public class Drawing extends JFrame { +public class Drawing extends JPanel { private Color currentColor = Color.BLACK; private int brushSize = 10; private boolean eraserMode = false; + private boolean hasDrawn = false; // Indicateur pour savoir si un dessin a été effectué + private DrawArea drawArea; + private JButton saveButton; // Bouton pour enregistrer public Drawing() { - setTitle("Application de Dessin"); + //setTitle("Application de Dessin"); setSize(800, 600); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - // Zone de dessin drawArea = new DrawArea(); drawArea.setBackground(Color.WHITE); - // Bouton pour choisir la couleur + // Créer les boutons et options (sans icônes ni curseur personnalisé) JButton colorButton = new JButton("Couleur"); - colorButton.setFocusable(false); colorButton.addActionListener(e -> chooseColor()); - // Bouton pour effacer tout JButton eraseButton = new JButton("Effacer tout"); - eraseButton.setFocusable(false); - eraseButton.addActionListener(e -> drawArea.clear()); + eraseButton.addActionListener(e -> { + drawArea.clear(); + hasDrawn = false; // Réinitialiser le statut + saveButton.setEnabled(false); // Désactiver le bouton d'enregistrement + }); - // Slider pour choisir la taille du pinceau JSlider sizeSlider = new JSlider(1, 50, brushSize); sizeSlider.setMajorTickSpacing(10); sizeSlider.setPaintTicks(true); sizeSlider.setPaintLabels(true); - sizeSlider.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - brushSize = sizeSlider.getValue(); - } - }); + sizeSlider.addChangeListener(e -> brushSize = sizeSlider.getValue()); - // Bouton pour activer/désactiver la gomme JButton eraserButton = new JButton("Gomme"); - eraserButton.setFocusable(false); eraserButton.addActionListener(e -> eraserMode = !eraserMode); - // Disposition des éléments d'interface dans un JPanel avec un FlowLayout + // Bouton "Enregistrer" désactivé par défaut + saveButton = new JButton("Enregistrer"); + saveButton.setEnabled(false); // Désactivé par défaut + saveButton.addActionListener(e -> saveDrawing()); + + // Disposition des éléments d'interface JPanel controls = new JPanel(); - controls.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); // Espacement entre les composants controls.add(colorButton); - controls.add(new JLabel("Taille du pinceau :")); + controls.add(new JLabel("Taille du stylo :")); controls.add(sizeSlider); controls.add(eraserButton); controls.add(eraseButton); + controls.add(saveButton); // Ajout du bouton d'enregistrement // Ajouter les composants à la fenêtre + setLayout(new BorderLayout()); add(controls, BorderLayout.NORTH); add(drawArea, BorderLayout.CENTER); @@ -74,10 +76,33 @@ public class Drawing extends JFrame { } } - // Zone de dessin personnalisée - private class DrawArea extends JPanel { + // Méthode pour enregistrer le dessin dans un fichier + private void saveDrawing() { + if (!hasDrawn) { + JOptionPane.showMessageDialog(this, "Rien n'a été dessiné à enregistrer.", "Erreur", JOptionPane.ERROR_MESSAGE); + return; + } + + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogTitle("Enregistrer le dessin"); + int userSelection = fileChooser.showSaveDialog(this); + + if (userSelection == JFileChooser.APPROVE_OPTION) { + File fileToSave = fileChooser.getSelectedFile(); + try { + // Crée un fichier PNG + ImageIO.write(drawArea.getImage(), "png", new File(fileToSave.getAbsolutePath() + ".png")); + JOptionPane.showMessageDialog(this, "Dessin enregistré avec succès !"); + } catch (IOException ex) { + ex.printStackTrace(); + JOptionPane.showMessageDialog(this, "Erreur lors de l'enregistrement du fichier.", "Erreur", JOptionPane.ERROR_MESSAGE); + } + } + } - private Image image; + // Zone de dessin + private class DrawArea extends JPanel { + private BufferedImage image; private Graphics2D g2d; private int prevX, prevY; @@ -103,45 +128,26 @@ public class Drawing extends JFrame { int y = e.getY(); if (eraserMode) { - g2d.setColor(Color.WHITE); // Utiliser la gomme + g2d.setColor(Color.WHITE); // Mode gomme } else { - g2d.setColor(currentColor); // Utiliser la couleur sélectionnée + g2d.setColor(currentColor); // Mode pinceau } - // Dessiner un trait continu g2d.setStroke(new BasicStroke(brushSize, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); g2d.drawLine(prevX, prevY, x, y); - repaint(); prevX = x; prevY = y; - } - }); - // Redimensionner l'image lors du redimensionnement de la fenêtre - addComponentListener(new ComponentAdapter() { - @Override - public void componentResized(ComponentEvent e) { - if (g2d != null) { - Image newImage = createImage(getWidth(), getHeight()); - Graphics2D g2dNew = (Graphics2D) newImage.getGraphics(); - g2dNew.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2dNew.setColor(Color.WHITE); - g2dNew.fillRect(0, 0, getWidth(), getHeight()); - g2dNew.drawImage(image, 0, 0, null); // Copie l'ancien contenu sur la nouvelle image - g2d = g2dNew; - image = newImage; - } else { - initDrawing(getSize().width, getSize().height); - } - repaint(); + hasDrawn = true; // Marque le fait qu'un dessin a été effectué + saveButton.setEnabled(true); // Active le bouton d'enregistrement } }); } - // Méthode pour initialiser l'image de dessin + // Initialisation de l'image de dessin private void initDrawing(int width, int height) { - image = createImage(width, height); + image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); g2d = (Graphics2D) image.getGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(Color.WHITE); @@ -149,7 +155,7 @@ public class Drawing extends JFrame { g2d.setColor(Color.BLACK); } - // Méthode pour effacer le dessin + // Effacer tout public void clear() { g2d.setPaint(Color.WHITE); g2d.fillRect(0, 0, getSize().width, getSize().height); @@ -157,6 +163,11 @@ public class Drawing extends JFrame { repaint(); } + // Retourne l'image en cours de dessin + public BufferedImage getImage() { + return image; + } + @Override protected void paintComponent(Graphics g) { super.paintComponent(g); diff --git a/src/main/java/beans/Question.java b/src/main/java/beans/Question.java index 0372ce9..77b10dc 100644 --- a/src/main/java/beans/Question.java +++ b/src/main/java/beans/Question.java @@ -5,14 +5,13 @@ package beans; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Random; /** * * @author Clément GROSSELLE */ public class Question implements Serializable { + private int id; private int level; private String statement; @@ -20,14 +19,14 @@ public class Question implements Serializable { public Question() { } - + public Question(Question q) { this.id = q.id; this.level = q.level; this.statement = q.statement; this.answer = q.answer; } - + public void setId(int id) { this.id = id; } diff --git a/src/main/java/com/mycompany/groupe_05/ContentFrame.java b/src/main/java/com/mycompany/groupe_05/ContentFrame.java new file mode 100644 index 0000000..0f07ae9 --- /dev/null +++ b/src/main/java/com/mycompany/groupe_05/ContentFrame.java @@ -0,0 +1,129 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package com.mycompany.groupe_05; + +import beans.Drawing; +import gui.MainMenu; +import gui.QuestionsGui; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; + +/** + * + * @author stag + */ +public class ContentFrame extends JFrame { + + private static final long serialVersionUID = 1L; + + private final JPanel content; + private final MainMenu menuPanel; + private final Drawing drawingPane; + private final Container mathPane; + private final QuestionsGui questionsPane; + private final JMenuBar menuBar; + + + + public ContentFrame() { + content = new JPanel(new BorderLayout()); + drawingPane = new Drawing(); + questionsPane = new QuestionsGui(); + mathPane = new JPanel(); + menuPanel = new MainMenu(); + menuBar = new JMenuBar(); + + setTitle("Multi Jeux"); + initGui(); + initEvent(); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setResizable(true); + setSize(800, 600); + setLocationRelativeTo(null); + setVisible(true); + + } + + private void initGui() { + initMenuBar(); + initMenuPanel(); + content.add(menuPanel, BorderLayout.WEST); + setJMenuBar(menuBar); + setContentPane(content); + } + + private void initEvent() { + menuPanel.getDrawButton().addActionListener((ActionEvent ae) -> { + switchActivities(drawingPane); + }); + menuPanel.getMathButton().addActionListener((ActionEvent ae) -> { + switchActivities(mathPane); + }); + menuPanel.getQuestButton().addActionListener((ActionEvent ae) -> { + switchActivities(questionsPane); + }); + } + + private void initMenuBar() { + //Définition des différents groupes de menus + JMenu activitiesMenu = new JMenu("Jeux"); + JMenu optionsMenu = new JMenu("Options"); + JMenu otherMenu = new JMenu("Infos"); + + JMenuItem drawI = new JMenuItem("Ardoise magique"); + JMenuItem mathI = new JMenuItem("Test de maths"); + JMenuItem questI = new JMenuItem("Culture générale"); + JMenuItem newQuestI = new JMenuItem("Créer nouvelle question"); + JMenuItem helpI = new JMenuItem("Besoin d'aide?"); + JMenuItem mainI = new JMenuItem("Menu Principal"); + JMenuItem exitI = new JMenuItem("Quitter"); + + activitiesMenu.add(drawI); + activitiesMenu.add(mathI); + activitiesMenu.add(questI); + + optionsMenu.add(mainI); + optionsMenu.add(newQuestI); + optionsMenu.add(exitI); + + otherMenu.add(helpI); + + menuBar.add(activitiesMenu); + menuBar.add(optionsMenu); + menuBar.add(otherMenu); + drawI.addActionListener(ae -> switchActivities(drawingPane)); + mathI.addActionListener(ae -> switchActivities(mathPane)); + questI.addActionListener(ae -> switchActivities(questionsPane)); + mainI.addActionListener((ActionEvent ae) -> { + content.add(menuPanel, BorderLayout.WEST); + }); + exitI.addActionListener(ae -> System.exit(0)); + + } + + private void initMenuPanel() { + } + + private void switchActivities(Container newActivitie) { + content.removeAll(); + //content.add(menuPanel, BorderLayout.WEST); + add(newActivitie, BorderLayout.CENTER); + revalidate(); + repaint(); + + } +} diff --git a/src/main/java/com/mycompany/groupe_05/Groupe_05.java b/src/main/java/com/mycompany/groupe_05/Groupe_05.java index 2a77405..762bfc9 100644 --- a/src/main/java/com/mycompany/groupe_05/Groupe_05.java +++ b/src/main/java/com/mycompany/groupe_05/Groupe_05.java @@ -3,6 +3,7 @@ package com.mycompany.groupe_05; public class Groupe_05 { public static void main(String[] args) { + ContentFrame content = new ContentFrame(); } } diff --git a/src/main/java/com/mycompany/groupe_05/TestFrame.java b/src/main/java/com/mycompany/groupe_05/TestFrame.java index caca067..a03ee5d 100644 --- a/src/main/java/com/mycompany/groupe_05/TestFrame.java +++ b/src/main/java/com/mycompany/groupe_05/TestFrame.java @@ -13,6 +13,8 @@ import javax.swing.JPanel; * @author stag */ public class TestFrame extends JFrame { + + private static final long serialVersionUID = 1L; JPanel qPane = new QuestionsGui(); public TestFrame() { diff --git a/src/main/java/gui/MainMenu.java b/src/main/java/gui/MainMenu.java new file mode 100644 index 0000000..17b787c --- /dev/null +++ b/src/main/java/gui/MainMenu.java @@ -0,0 +1,77 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package gui; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridLayout; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; + +/** + * + * @author stag + */ +public class MainMenu extends JPanel { + + private JLabel menuLabel; + private JPanel topMenuPanel; + private JButton drawButton, mathButton, questButton, hideButton; + + public MainMenu() { + initGui(); + initEvent(); + + } + + private void initEvent() { + } + + private void initGui() { + + topMenuPanel = new JPanel(new BorderLayout()); + menuLabel = new JLabel("Menu Principal"); + menuLabel.setHorizontalAlignment(JLabel.CENTER); + menuLabel.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY)); + hideButton = new JButton("<"); + hideButton.setPreferredSize(new Dimension(30, 30)); + topMenuPanel.add(menuLabel, BorderLayout.CENTER); + topMenuPanel.add(hideButton, BorderLayout.NORTH); + + drawButton = new JButton("Ardoise Magique"); + mathButton = new JButton("Test de maths"); + questButton = new JButton("Culture générale"); + + setLayout(new GridLayout(0, 1)); + //menuPanel.setBorder(BorderFactory.createLineBorder(Color.black)); + + add(topMenuPanel); + add(drawButton); + add(mathButton); + add(questButton); + + setPreferredSize(new Dimension(200, getHeight())); + } + + public JButton getDrawButton() { + return drawButton; + } + + public JButton getMathButton() { + return mathButton; + } + + public JButton getQuestButton() { + return questButton; + } + + public JButton getHideButton() { + return hideButton; + } + +} diff --git a/src/main/java/gui/QuestionsGui.java b/src/main/java/gui/QuestionsGui.java index 00d62d9..0becab0 100644 --- a/src/main/java/gui/QuestionsGui.java +++ b/src/main/java/gui/QuestionsGui.java @@ -6,6 +6,8 @@ package gui; import beans.Question; import dao.DaoQuestion; +import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; @@ -60,7 +62,7 @@ public class QuestionsGui extends JPanel { // Config labels: // Question - sLabel = new JLabel("" + q.getStatement() + ""); + sLabel = new JLabel(q.getStatement()); sLabel.setFont(labelFont); sLabel.setHorizontalAlignment(JLabel.CENTER); @@ -74,7 +76,7 @@ public class QuestionsGui extends JPanel { aLabel.setFont(helpFont); aLabel.setHorizontalAlignment(JLabel.CENTER); - atf = new JTextField(); + atf = new JTextField(5); // Paramétrage des dfférentes font confirmButton.setFont(buttonFont); @@ -89,23 +91,12 @@ public class QuestionsGui extends JPanel { private void initGui() { // Layout - questionsPane.setLayout(new BoxLayout(questionsPane, BoxLayout.Y_AXIS)); + questionsPane.setLayout(new BorderLayout()); answerPane.setLayout(new BoxLayout(answerPane, BoxLayout.Y_AXIS)); //Size - //questionsPane.setPreferredSize(new Dimension(600, 600)); - statmentPane.setPreferredSize(new Dimension(300, 50)); + statmentPane.setPreferredSize(new Dimension(600, 50)); helpPane.setPreferredSize(new Dimension(200, 50)); - //answerPane.setPreferredSize(new Dimension(50, 20)); - //buttonsPane.setPreferredSize(new Dimension(600, 150)); - - //Border - questionsPane.setBorder(BorderFactory.createEmptyBorder(30, 10, 10, 10)); - //this.setBorder(BorderFactory.createLineBorder(Color.green)); - //questionsPane.setBorder(BorderFactory.createLineBorder(Color.green)); - //statmentPane.setBorder(BorderFactory.createLineBorder(Color.yellow)); - //answerPane.setBorder(BorderFactory.createLineBorder(Color.green)); - //buttonsPane.setBorder(BorderFactory.createLineBorder(Color.blue)); //Ajout des composants //Question @@ -121,10 +112,10 @@ public class QuestionsGui extends JPanel { buttonsPane.add(nextButton); // Panneau principal de l'activité - questionsPane.add(statmentPane); - questionsPane.add(helpPane); - questionsPane.add(answerPane); - questionsPane.add(buttonsPane); + questionsPane.add(statmentPane, BorderLayout.NORTH); + questionsPane.add(helpPane, BorderLayout.CENTER); + questionsPane.add(answerPane, BorderLayout.CENTER); + questionsPane.add(buttonsPane, BorderLayout.SOUTH); // Pas sur pour ça this.add(questionsPane); @@ -164,7 +155,7 @@ public class QuestionsGui extends JPanel { hLabel.setText(""); System.out.println("bouton suivant\n Nombre de questions restantes:" + qlist.size()); if (!qlist.isEmpty()) { - // Si il reste des question dans la liste, on passa a la suivante + // Si il reste des question dans la liste, on passe à la suivante changeQuestion(); } else { // Sinon on réinjecte les questions de la bdd et zérapatis diff --git a/target/classes/beans/Drawing$DrawArea$1.class b/target/classes/beans/Drawing$DrawArea$1.class index 8010ec4c6b24722ecab7f797fdc34d6c9bd03767..2239d545ab2f88aad207e903b8058500bdd437e6 100644 GIT binary patch delta 35 qcmeC@?C0FDoSCt3@(Si!!4d{;hEfJGhB5{PhH?gLhRVriERg`PItaP| delta 35 qcmeC@?C0FDoS89V@(Si!!Dt3*CJz}coWKduT=3xk7P+?@?$Ve=9DM~EQ0||!lFoZKi zFfwozCzho;m6nv`=P@#f`eY@RC06JcmuKds>w7_jt+^PY7^2x3Vt5#08R8fjgt4dr znUh-LnwOZAlbXWFz@ibQ8OF$S$r`&Gb3ZcWDb^S)_4X+hJ?u(EDE-X3=9lx z42%p63^fc%3=9ln3``6R4Ezkq3@HpCz|X)6mS<#0Wk>_*Vqjp@VqjxnVPIfbGWjS= zSH0F22F5K6QY>2;f}qST452LB7$P?^FfcGPfGjX$;ALQ7sAphhXkg%CXkrj&Xl77n zXl1Zw=wOIs=wv8n=whg1=w@hQ=waw$=wq15(9f`#VFK7eS`e$?4qC#H&XB>t$iT`l zpCOaMmcf^afs0`lLl%QA12aQ50|NsG1Jhpybw);E1{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X)mnk(pd<H!J3hQIo&9QkwFw; zI6|2%a;Gq)vNNRdFr+hNOpanv)=y!`;$g^U z$Y5k(%Sg>k&nN+fYc3B%9s>^}1A9?wL1JcJ2^RwgLjey%Aw$vRH7q*ZB@CtP3}rkF z*AG5rk{D(D=v3s%~n+{7qBZKs017_*TGueb~^%(RS7#Ns9VFIQr88X0h6^IrP zU|?lnV_;xlVPIt7W~gRhWT;_aU?^c=Wnf}pU@)8fl1-ytYd3>pq?Yz}2IXxGDjUI? zYZ(|Aq`(?O7&sY18Tc3?7^E4J88jHG7)%*@80r`p7MK}ImtGcfq`KH0~f3utn!#=d1wfV8wL>jytXk!gILVWTH6@nw=g6_ zsLX8)2nR)LZDYtmI7*Cxm4Sg_76TW7#1Fi0}AFtjo-GPE%;FfcPPN-!`pw1Z=&gP{{lcQN!ZFfeF=t?pvzWnf|u aWME*BW&lSvh-6?;gis8947LmtSU3Rzjoa%0 diff --git a/target/classes/beans/Drawing.class b/target/classes/beans/Drawing.class index 8446deb921d5b3066c847610903ca43ed4a29d4f..7f27ae2097e4af77efd5db3137274ea74deccc5c 100644 GIT binary patch literal 5506 zcmX^0Z`VEs1_oP36)pxQ24;2!79Ivx1~x_pp{&HR#0vf5^31$+eXoGTywn^<1~!|_ zyv!0iMh0dL%`i>|4hBwk1}+{3ZU!Dk20oAm{lxMTedqj~{31pMRwo}vXKzLZ0UuNu zYfc6}27Y!10UicHkVf95)Wp1EeV3v{kX?)nJjta+MX7luU}HdPg?Si67(^KvIFpJ> zi!*{Vt5O*m7(GEU;yerz43dltT&YEg#i>QU`6(c&D3Fvi4}%OyiX$Vj7-V!F7Xu%I z91nv$g90N1dvR(B#2i))PfyJ-b_OLz1~C+OsDLy%7NsU~F(@*qfC5F8kwHkq2St%J zC=~b@)Oi>*7&I9fI8urd%Rzb=86;2@!cDUVg_<@GgAT~&tl=J>A+8_`^mrKb84MU1 zc#Bg@oD!3>(~I&;^HLZYgf-9u59C-QMh0O}n8KsSskEddKaYdKgp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WVM~a#z&iZ8-ty;)-DDo28L}6ZeR(o?F=@)Iv@!htz8U0Pzm2i76Buz zEet~28T|cp1-P~`1nIJDV+aKi5xTn>qU$5Ibhk6aZevIQo077f!N!V3k_BXrB#YKA zhBT-_>5WG&nV2`$SA?!#4wG4fx!+EQw-A?W-u@?cr%=1n8`4UfsrAFVJpLIhFJ_u z3{4Ev8Rjs|WngAl#gNZ1k6{)A3&RnHP=@&o3m8}#m>4F*;+-Lffti7cfq_AaQK(I8 z3j^;Ch7KR?q+<-cTH0F~c(s_fGKhgff|&sn5@HOj3=9lz4BQOv4Ezip3?dAk43Z4q zU`L5TjDb3en}MHUAp;KsBf}yF1_llW#y<>_>{J7*ctfP8J06Ju`}>73NV4P2FOST1_m1jMzAwD zK#{qPp%3JACa}{X)+i!b!@*Dw2|$qh!1f3*f$|*GC`+hOtXkU`CZd}ogJcdX+_|h! z=dv)Y2Dy@94Z~Un1_n@(tHH32VFSY^hG>Q@3=9kk49pB$8JHOY_b}{b*aK$nVK@M1 s9cI|WaEt*ICTt8E415g78JHNN86aRCgksnLr8hz86AY&q&M-&<0EcCxKmY&$ diff --git a/target/classes/com/mycompany/groupe_05/Groupe_05.class b/target/classes/com/mycompany/groupe_05/Groupe_05.class index 78dca1628b6f5d3929f5e096eb60e2bce3725a62..a0eeebeb114dc683503b8f3fdb516b4ab30e50c9 100644 GIT binary patch delta 248 zcmbQkI*Wzt)W2Q(7#J9A86+oinJ}tMw3iTf&d)1J%`0&$O3Y2=Vqj-rW@q4LWKf(e z&!{-@*(@IRWQaT?gPPAodkG$7<&)PlD%Eo_Ffo7t69XdyD+3z?BLfcu1A{&TBLgD? z0|Tqpb_T|c3=9lR47>~sU}**hW(Gb61_mC80tS8t0R{#JP6j~+A*g0Y1}3nfoVyv= tBeyef`XCH|*v7`d!N3kSL`(sql0le3gn@y9gMpDjltBz^xj5KX2>_;~AejIF delta 400 zcmbQmGKZDx)W2Q(7#J9A8B`~7nJ_9&w3nz4Ni8mMD@x2wOGVrG)=Igs8<|AZy8JM{kco_tF7=##v85vm8GV@Xx8H6=F zHGNPGv1VrwWn@rH&d=4)txV3(ElA9()K4$UpBTVC@d4+={#p8rg^UaW=(-pgSW*)6 z3mF*%ebDTl9LcC8EW*IV00K-5j0~&{Yz&MHVw3wA#p=Zw7{ELbDZ#+Nz{9}Ez`(%D zAju%bz`(%CAk82HQp>==kjuctz|6qFAitY|J#sq(XZUUguE^~SJU+V_cq6wn@cZhp zY-14c*~q}az{CJDR*ZoaYy<}b7lQx;H-iKN4}%;7KLf}b1&C1$%CZb{3=9kc4Ezl8 Y3