diff --git a/src/Dessin.class b/src/Dessin.class
new file mode 100644
index 0000000..7e611f9
Binary files /dev/null and b/src/Dessin.class differ
diff --git a/src/Dessin.java b/src/Dessin.java
index 8c58016..c90cfaf 100644
--- a/src/Dessin.java
+++ b/src/Dessin.java
@@ -47,8 +47,7 @@ public class Dessin extends JPanel {
graphics2D.drawLine(postXCoordinate, marginPixels, postXCoordinate + beamLength, marginPixels);
// Renfort diagonal
- graphics2D.drawLine(postXCoordinate, marginPixels + height / 10,
- postXCoordinate + width / 12, marginPixels);
+ graphics2D.drawLine(postXCoordinate, marginPixels + height / 10, postXCoordinate + width / 12, marginPixels);
// Corde
int ropeXCoordinate = postXCoordinate + beamLength;
@@ -60,8 +59,7 @@ public class Dessin extends JPanel {
int headRadiusPixels = Math.min(width, height) / 16;
int headCenterX = ropeXCoordinate;
int headCenterY = ropeBottomYCoordinate + headRadiusPixels;
- graphics2D.drawOval(headCenterX - headRadiusPixels, headCenterY - headRadiusPixels,
- headRadiusPixels * 2, headRadiusPixels * 2);
+ graphics2D.drawOval(headCenterX - headRadiusPixels, headCenterY - headRadiusPixels, headRadiusPixels * 2, headRadiusPixels * 2);
// Corps
int bodyTopYCoordinate = headCenterY + headRadiusPixels;
@@ -71,17 +69,13 @@ public class Dessin extends JPanel {
// Bras
int armSpanPixels = width / 10;
int shouldersYCoordinate = bodyTopYCoordinate + height / 24;
- graphics2D.drawLine(headCenterX, shouldersYCoordinate,
- headCenterX - armSpanPixels, shouldersYCoordinate + height / 20);
- graphics2D.drawLine(headCenterX, shouldersYCoordinate,
- headCenterX + armSpanPixels, shouldersYCoordinate + height / 20);
+ graphics2D.drawLine(headCenterX, shouldersYCoordinate, headCenterX - armSpanPixels, shouldersYCoordinate + height / 20);
+ graphics2D.drawLine(headCenterX, shouldersYCoordinate, headCenterX + armSpanPixels, shouldersYCoordinate + height / 20);
// Jambes
int legSpanPixels = width / 12;
- graphics2D.drawLine(headCenterX, bodyBottomYCoordinate,
- headCenterX - legSpanPixels, bodyBottomYCoordinate + height / 8);
- graphics2D.drawLine(headCenterX, bodyBottomYCoordinate,
- headCenterX + legSpanPixels, bodyBottomYCoordinate + height / 8);
+ graphics2D.drawLine(headCenterX, bodyBottomYCoordinate, headCenterX - legSpanPixels, bodyBottomYCoordinate + height / 8);
+ graphics2D.drawLine(headCenterX, bodyBottomYCoordinate, headCenterX + legSpanPixels, bodyBottomYCoordinate + height / 8);
graphics2D.dispose();
}
diff --git a/src/Event$1.class b/src/Event$1.class
new file mode 100644
index 0000000..f788020
Binary files /dev/null and b/src/Event$1.class differ
diff --git a/src/Event.class b/src/Event.class
new file mode 100644
index 0000000..d707c90
Binary files /dev/null and b/src/Event.class differ
diff --git a/src/Event.java b/src/Event.java
index 4b581d9..88d9394 100644
--- a/src/Event.java
+++ b/src/Event.java
@@ -3,28 +3,28 @@ import java.awt.event.*;
import java.util.function.Consumer;
/**
-* La classe Event regroupe et branche tous les listeners liés à Fenetre.
-* - Validation de la saisie (1 lettre A-Z, majuscule)
-* - Action sur Entrée ou clic bouton
-* - Notification du handler externe (fourni au constructeur)
-* Aucune logique de jeu ici.
-* @version 1.2
-* author Adrien
-* Date : 08-10-2025
-* Licence :
-*/
+ * La classe Event regroupe et branche tous les listeners liés à Fenetre.
+ * - Validation de la saisie (1 lettre A-Z, majuscule)
+ * - Action sur Entrée ou clic bouton
+ * - Notification du handler externe (fourni au constructeur)
+ * Aucune logique de jeu ici.
+ * @version 1.3
+ * author Adrien
+ * Date : 08-10-2025
+ */
public class Event implements ActionListener {
private final Fenetre window;
private final Consumer onLetterSubmitted;
+ /** Constructeur : conserve les références et branche les événements. */
public Event(Fenetre window, Consumer onLetterSubmitted) {
this.window = window;
this.onLetterSubmitted = onLetterSubmitted;
wireEvents();
}
- /** Branche les listeners sur les composants de Fenetre. */
+ /** Branche les listeners sur les composants de Fenetre.*/
private void wireEvents() {
JTextField letterInput = window.getLetterInput();
JButton sendButton = window.getSendButton();
@@ -47,27 +47,26 @@ public class Event implements ActionListener {
});
}
- /** Réagit à Entrée ou au clic bouton : soumet la lettre. */
+ /** Réagit à Entrée ou au clic bouton : récupère, valide et transmet la lettre. */
@Override
public void actionPerformed(ActionEvent actionEvent) {
- submitLetter();
- }
-
- /** Récupère, valide et transmet la lettre au handler externe. */
- private void submitLetter() {
JTextField letterInput = window.getLetterInput();
- String inputText = letterInput.getText().trim().toUpperCase();
- letterInput.setText("");
+ String inputText = letterInput.getText().trim().toUpperCase();
+ letterInput.setText(""); // reset du champ après tentative
+
+ // Validation : exactement une lettre A–Z
if (inputText.length() != 1 || !inputText.matches("[A-Z]")) {
JOptionPane.showMessageDialog(window.getWindow(), "Veuillez entrer une seule lettre (A-Z).");
return;
}
+ // Notification du handler externe, sinon placeholder
if (onLetterSubmitted != null) {
onLetterSubmitted.accept(inputText.charAt(0));
} else {
- JOptionPane.showMessageDialog(window.getWindow(), "Lettre soumise (placeholder) : " + inputText);
+ JOptionPane.showMessageDialog(window.getWindow(),
+ "Lettre soumise (placeholder) : " + inputText);
}
}
}
diff --git a/src/Fenetre.class b/src/Fenetre.class
new file mode 100644
index 0000000..97ced7c
Binary files /dev/null and b/src/Fenetre.class differ
diff --git a/src/Partie.class b/src/Partie.class
new file mode 100644
index 0000000..85cd51f
Binary files /dev/null and b/src/Partie.class differ
diff --git a/src/Pendu.class b/src/Pendu.class
new file mode 100644
index 0000000..3fd926e
Binary files /dev/null and b/src/Pendu.class differ