wow le tp là
This commit is contained in:
0
DEV1.1/TP19/sort.PY
Normal file
0
DEV1.1/TP19/sort.PY
Normal file
5
DEV1.1/TP19/sort.py
Normal file
5
DEV1.1/TP19/sort.py
Normal file
@@ -0,0 +1,5 @@
|
||||
t = [5,8,8,7,5,8,3,5,7,8,4,4,4,5,3,1,2,3,7]
|
||||
|
||||
t.sort()
|
||||
|
||||
print(t)
|
Binary file not shown.
@@ -1,15 +1,15 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
String[] sujets = {
|
||||
"Luc",
|
||||
"Denis",
|
||||
"Régine",
|
||||
"Selma",
|
||||
"Frédéric"
|
||||
"Siobhane",
|
||||
"Lukas",
|
||||
"Maxime",
|
||||
"Nima",
|
||||
"Mehdi"
|
||||
};
|
||||
|
||||
String[] verbes = {
|
||||
"aime",
|
||||
"mord",
|
||||
"déteste",
|
||||
"tue",
|
||||
"mange",
|
||||
@@ -17,10 +17,10 @@ public class Main {
|
||||
};
|
||||
|
||||
String[] complements = {
|
||||
"Windows",
|
||||
"Sasha",
|
||||
"les pommes",
|
||||
"Elizabeth II",
|
||||
"les batyscaphes" // Je sais même pas si c'est un nom commun en vrai
|
||||
"le capitalisme" // Je sais même pas si c'est un nom commun en vrai
|
||||
};
|
||||
|
||||
Exquis sujet = new Exquis(sujets);
|
||||
|
19
DEV2.1/Menu.java
Normal file
19
DEV2.1/Menu.java
Normal file
@@ -0,0 +1,19 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
public class Menu extends JFrame{
|
||||
|
||||
public Menu() {
|
||||
this.setSize(800, 1000);
|
||||
this.setLocation(500, 0);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
FondMenuPrincipale menu = new FondMenuPrincipale();
|
||||
this.add(menu);
|
||||
this.addMouseListener(new Quitter());
|
||||
this.addMouseListener(new BoutonJouer(this));
|
||||
|
||||
}
|
||||
}
|
Submodule DEV2.1/SAE21_2025 updated: b9598b5ae3...9a2f651524
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,7 @@ public class Fond {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
try {
|
||||
UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
|
||||
UIManager.setLookAndFeel("javax.swing.plaf.nimbus");
|
||||
} catch (ClassNotFoundException e) {
|
||||
}
|
||||
} catch (InstantiationException e2) {
|
||||
|
BIN
DEV2.1/TP14/02_Couleurs/Composant.class
Normal file
BIN
DEV2.1/TP14/02_Couleurs/Composant.class
Normal file
Binary file not shown.
@@ -5,17 +5,21 @@ public class Composant extends JComponent {
|
||||
|
||||
private Color couleur1;
|
||||
private Color couleur2;
|
||||
private JLabel nomCouleur1;
|
||||
private JLabel nomCouleur2;
|
||||
private String nomCouleur1;
|
||||
private String nomCouleur2;
|
||||
|
||||
public Composant(Color couleur1, Color couleur2) {
|
||||
public Composant(Color couleur1, Color couleur2, String nomCouleur1, String nomCouleur2) {
|
||||
this.couleur1 = couleur1;
|
||||
this.couleur2 = couleur2;
|
||||
this.nomCouleur1 = nomCouleur1;
|
||||
this.nomCouleur2 = nomCouleur2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics pinceau) {
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
FontMetrics metrique = pinceau.getFontMetrics();
|
||||
int tailleTexte1 = metrique.stringWidth(this.nomCouleur2);
|
||||
|
||||
int[] x1 = {0, 0, this.getWidth()};
|
||||
int[] y1 = {0, this.getHeight(), this.getHeight()};
|
||||
@@ -28,14 +32,26 @@ public class Composant extends JComponent {
|
||||
secondPinceau.setColor(this.couleur2);
|
||||
secondPinceau.fillPolygon(x2, y2, 3);
|
||||
|
||||
JLabel couleur1Nom = this.nomCouleur1;
|
||||
JLabel couleur2Nom = this.nomCouleur2;
|
||||
secondPinceau.setColor(this.couleur1);
|
||||
secondPinceau.drawString(this.nomCouleur2, this.getWidth() - tailleTexte1 - 10, metrique.getAscent() + 10);
|
||||
secondPinceau.setColor(this.couleur2);
|
||||
secondPinceau.drawString(this.nomCouleur1, 10, this.getHeight() - 10);
|
||||
|
||||
couleur1Nom.setHorizontalAlignment(JLabel.RIGHT);
|
||||
couleur2Nom.setHorizontalAlignment(JLabel.LEFT);
|
||||
|
||||
this.setLayout(new BorderLayout());
|
||||
this.add(couleur1Nom, BorderLayout.NORTH);
|
||||
this.add(couleur2Nom, BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
public void setCouleur1(Color couleur) {
|
||||
this.couleur1 = couleur;
|
||||
}
|
||||
|
||||
public void setCouleur2(Color couleur) {
|
||||
this.couleur2 = couleur;
|
||||
}
|
||||
|
||||
public void setNomCouleur1(String couleur) {
|
||||
this.nomCouleur1 = couleur;
|
||||
}
|
||||
|
||||
public void setNomCouleur2(String couleur) {
|
||||
this.nomCouleur2 = couleur;
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP14/02_Couleurs/Fenetre.class
Normal file
BIN
DEV2.1/TP14/02_Couleurs/Fenetre.class
Normal file
Binary file not shown.
@@ -7,9 +7,15 @@ public class Fenetre extends JFrame {
|
||||
this.setSize(200, 200);
|
||||
this.setLocation(100, 100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setLayout(new GridLayout(1, 1));
|
||||
Color couleur1 = // TODO
|
||||
Color couleur2 = // TODO
|
||||
this.add(new Composant(couleur1, couleur2));
|
||||
this.setLayout(new BorderLayout());
|
||||
LectureFichier fichier = new LectureFichier();
|
||||
Color couleur1 = fichier.getCouleurs()[64];
|
||||
Color couleur2 = fichier.getCouleurs()[16];
|
||||
String nom1 = fichier.getNomsCouleurs()[64];
|
||||
String nom2 = fichier.getNomsCouleurs()[16];
|
||||
|
||||
Composant composant = new Composant(couleur1, couleur2, nom1, nom2);
|
||||
this.add(composant, BorderLayout.CENTER);
|
||||
this.addMouseWheelListener(new GestionMoletteSouris(composant, fichier.getCouleurs(), fichier.getNomsCouleurs()));
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP14/02_Couleurs/GestionMoletteSouris.class
Normal file
BIN
DEV2.1/TP14/02_Couleurs/GestionMoletteSouris.class
Normal file
Binary file not shown.
@@ -0,0 +1,55 @@
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class GestionMoletteSouris implements MouseWheelListener {
|
||||
|
||||
private Composant composant;
|
||||
private Color[] tabCouleurs ;
|
||||
private String[] tabNomsCouleurs;
|
||||
private int positionTabCouleurs1;
|
||||
private int positionTabCouleurs2;
|
||||
|
||||
public GestionMoletteSouris(Composant composant, Color[] tabCouleurs, String[] tabNomsCouleurs) {
|
||||
this.composant = composant;
|
||||
this.tabCouleurs = tabCouleurs;
|
||||
this.tabNomsCouleurs = tabNomsCouleurs;
|
||||
this.positionTabCouleurs1 = 64;
|
||||
this.positionTabCouleurs2 = 16;
|
||||
}
|
||||
|
||||
public void mouseWheelMoved(MouseWheelEvent evenement) {
|
||||
int posX = evenement.getX();
|
||||
int posY = evenement.getY();
|
||||
if (posX < posY) {
|
||||
if (evenement.getWheelRotation() < 0) {
|
||||
this.positionTabCouleurs1++;
|
||||
this.positionTabCouleurs1 = this.positionTabCouleurs1 % this.tabCouleurs.length;
|
||||
this.composant.setCouleur1(this.tabCouleurs[this.positionTabCouleurs1]);
|
||||
this.composant.setNomCouleur1(this.tabNomsCouleurs[this.positionTabCouleurs1]);
|
||||
}
|
||||
else {
|
||||
this.positionTabCouleurs1--;
|
||||
this.positionTabCouleurs1 = this.positionTabCouleurs1 % this.tabCouleurs.length;
|
||||
this.composant.setCouleur1(this.tabCouleurs[this.positionTabCouleurs1]);
|
||||
this.composant.setNomCouleur1(this.tabNomsCouleurs[this.positionTabCouleurs1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (evenement.getWheelRotation() < 0) {
|
||||
this.positionTabCouleurs2++;
|
||||
this.positionTabCouleurs2 = this.positionTabCouleurs2 % this.tabCouleurs.length;
|
||||
this.composant.setCouleur2(this.tabCouleurs[this.positionTabCouleurs2]);
|
||||
this.composant.setNomCouleur2(this.tabNomsCouleurs[this.positionTabCouleurs2]);
|
||||
}
|
||||
else {
|
||||
this.positionTabCouleurs2--;
|
||||
this.positionTabCouleurs2 = this.positionTabCouleurs2 % this.tabCouleurs.length;
|
||||
this.composant.setCouleur2(this.tabCouleurs[this.positionTabCouleurs2]);
|
||||
this.composant.setNomCouleur2(this.tabNomsCouleurs[this.positionTabCouleurs2]);
|
||||
}
|
||||
}
|
||||
System.out.println(positionTabCouleurs1 + " / " + positionTabCouleurs2);
|
||||
this.composant.repaint();
|
||||
}
|
||||
}
|
BIN
DEV2.1/TP14/02_Couleurs/LectureFichier.class
Normal file
BIN
DEV2.1/TP14/02_Couleurs/LectureFichier.class
Normal file
Binary file not shown.
@@ -1,5 +1,6 @@
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class LectureFichier {
|
||||
|
||||
@@ -7,13 +8,24 @@ public class LectureFichier {
|
||||
private String[] tabNomsCouleurs;
|
||||
|
||||
public LectureFichier() {
|
||||
|
||||
this.tabCouleurs = new Color[800];
|
||||
this.tabNomsCouleurs = new String[800];
|
||||
try {
|
||||
BufferedReader lecture = new BufferedReader(new FileReader("rgb.txt"));
|
||||
|
||||
try {
|
||||
String ligne = lecture.readLine();
|
||||
// TODO : Split, trim des lignes + Gestion Molette
|
||||
int compteur = 0;
|
||||
while (ligne != null) {
|
||||
int r = Integer.parseInt(ligne.substring(0, 3).replaceAll(" ", "0"));
|
||||
int g = Integer.parseInt(ligne.substring(4, 7).replaceAll(" ", "0"));
|
||||
int b = Integer.parseInt(ligne.substring(8, 11).replaceAll(" ", "0"));
|
||||
this.tabCouleurs[compteur] = new Color(r, g, b);
|
||||
ligne = ligne.substring(11, ligne.length()).replaceAll(" ", "");
|
||||
this.tabNomsCouleurs[compteur] = ligne;
|
||||
ligne = lecture.readLine();
|
||||
compteur++;
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
System.err.println("Erreur de lecture.");
|
||||
}
|
||||
@@ -27,4 +39,12 @@ public class LectureFichier {
|
||||
}
|
||||
}
|
||||
|
||||
public Color[] getCouleurs() {
|
||||
return this.tabCouleurs;
|
||||
}
|
||||
|
||||
public String[] getNomsCouleurs() {
|
||||
return this.tabNomsCouleurs;
|
||||
}
|
||||
|
||||
}
|
BIN
DEV2.1/TP14/02_Couleurs/Main.class
Normal file
BIN
DEV2.1/TP14/02_Couleurs/Main.class
Normal file
Binary file not shown.
1
DEV2.1/TP15/site.mdj
Normal file
1
DEV2.1/TP15/site.mdj
Normal file
File diff suppressed because one or more lines are too long
1
DEV2.1/TP15/transports.mdj
Normal file
1
DEV2.1/TP15/transports.mdj
Normal file
File diff suppressed because one or more lines are too long
1
DEV2.1/TP15/voitures.mdj
Normal file
1
DEV2.1/TP15/voitures.mdj
Normal file
File diff suppressed because one or more lines are too long
1
DEV2.1/TP17/blanchisserie.mdj
Normal file
1
DEV2.1/TP17/blanchisserie.mdj
Normal file
File diff suppressed because one or more lines are too long
1
DEV2.1/TP17/plateau.mdj
Normal file
1
DEV2.1/TP17/plateau.mdj
Normal file
File diff suppressed because one or more lines are too long
BIN
DEV2.1/controle_machine_3/Prototype.class
Normal file
BIN
DEV2.1/controle_machine_3/Prototype.class
Normal file
Binary file not shown.
36
DEV2.1/controle_machine_3/Prototype.java
Normal file
36
DEV2.1/controle_machine_3/Prototype.java
Normal file
@@ -0,0 +1,36 @@
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
public class Prototype {
|
||||
public static void main(String[] args) {
|
||||
if (args.length < 1) {
|
||||
System.err.println("Veuillez entrer un nom dans la ligne de commande.");
|
||||
}
|
||||
else {
|
||||
try {
|
||||
BufferedWriter flux = new BufferedWriter(new FileWriter(args[0] + ".java"));
|
||||
|
||||
try {
|
||||
flux.write("public class " + args[0] + " {");
|
||||
flux.newLine();
|
||||
flux.write(" public static void main(String[] args) {");
|
||||
flux.newLine();
|
||||
flux.write(" System.out.println(\"Bonjour, je m'appelle " + args[0] + ".java\");");
|
||||
flux.newLine();
|
||||
flux.write(" }");
|
||||
flux.newLine();
|
||||
flux.write("}");
|
||||
} catch (IOException e2) {
|
||||
System.err.println("Erreur d'écriture du fichier");
|
||||
}
|
||||
try {
|
||||
flux.close();
|
||||
} catch (IOException e3) {
|
||||
System.err.println("Erreur de fermeture du fichier");
|
||||
}
|
||||
} catch (IOException e1){
|
||||
System.err.println("Erreur de création/d'ouverture de fichier");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV2.1/controle_machine_3/Test.class
Normal file
BIN
DEV2.1/controle_machine_3/Test.class
Normal file
Binary file not shown.
5
DEV2.1/controle_machine_3/Test.java
Normal file
5
DEV2.1/controle_machine_3/Test.java
Normal file
@@ -0,0 +1,5 @@
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Bonjour, je m'appelle Test.java");
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP01/01_Vote/Main.class
Normal file
BIN
DEV3.1/TP01/01_Vote/Main.class
Normal file
Binary file not shown.
9
DEV3.1/TP01/01_Vote/Main.java
Normal file
9
DEV3.1/TP01/01_Vote/Main.java
Normal file
@@ -0,0 +1,9 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
if (args.length != 1) {
|
||||
System.err.println("Entrez une valeur dans la console.");
|
||||
System.exit(0);
|
||||
}
|
||||
Vote v = new Vote(args[0]);
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP01/01_Vote/Vote.class
Normal file
BIN
DEV3.1/TP01/01_Vote/Vote.class
Normal file
Binary file not shown.
52
DEV3.1/TP01/01_Vote/Vote.java
Normal file
52
DEV3.1/TP01/01_Vote/Vote.java
Normal file
@@ -0,0 +1,52 @@
|
||||
import org.mariadb.jdbc.*;
|
||||
import java.awt.*;
|
||||
import java.sql.*;
|
||||
|
||||
public class Vote {
|
||||
|
||||
private String competiteur;
|
||||
|
||||
public Vote(String competiteur) {
|
||||
this.competiteur = competiteur;
|
||||
|
||||
try {
|
||||
Connection cnx = DriverManager.getConnection(
|
||||
"jdbc:mariadb://dwarves.iut-fbleau.fr/simoes",
|
||||
"simoes", "simoes"
|
||||
);
|
||||
|
||||
try {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
} catch (ClassNotFoundException e2) {
|
||||
System.err.println("Problème de pilote.");
|
||||
}
|
||||
|
||||
try {
|
||||
PreparedStatement pst = cnx.prepareStatement(
|
||||
"SELECT votants, points FROM pays WHERE competiteur = '" + this.competiteur + "';"
|
||||
);
|
||||
|
||||
ResultSet rs = pst.executeQuery();
|
||||
|
||||
int total = 0;
|
||||
|
||||
while (rs.next()) {
|
||||
total += rs.getInt(2);
|
||||
System.out.println(rs.getString(1) + " " + rs.getInt(2));
|
||||
}
|
||||
|
||||
System.out.println("---------");
|
||||
System.out.println("Total " + total);
|
||||
|
||||
rs.close();
|
||||
pst.close();
|
||||
} catch (SQLException e3) {
|
||||
System.err.println("Erreur de syntaxe SQL.");
|
||||
}
|
||||
|
||||
cnx.close();
|
||||
} catch (SQLException e1) {
|
||||
System.err.println("Erreur de connexion à la base de données.");
|
||||
}
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP01/02_Victoire/Connexion.class
Normal file
BIN
DEV3.1/TP01/02_Victoire/Connexion.class
Normal file
Binary file not shown.
56
DEV3.1/TP01/02_Victoire/Connexion.java
Normal file
56
DEV3.1/TP01/02_Victoire/Connexion.java
Normal file
@@ -0,0 +1,56 @@
|
||||
import org.mariadb.jdbc.*;
|
||||
import javax.swing.*;
|
||||
import java.sql.*;
|
||||
|
||||
public class Connexion {
|
||||
|
||||
private int scoreMax;
|
||||
private String paysMax;
|
||||
|
||||
public Connexion() {
|
||||
try {
|
||||
Connection cnx = DriverManager.getConnection(
|
||||
"jdbc:mariadb://dwarves.iut-fbleau.fr/simoes",
|
||||
"simoes", "simoes"
|
||||
);
|
||||
|
||||
try {
|
||||
Class.forName("org.mariadb.jdbc.Driver");
|
||||
} catch (ClassNotFoundException e2) {
|
||||
System.err.println("Problème de pilote.");
|
||||
}
|
||||
|
||||
try {
|
||||
PreparedStatement pst = cnx.prepareStatement(
|
||||
"SELECT SUM(points), competiteur FROM pays GROUP BY competiteur ASC;"
|
||||
);
|
||||
|
||||
ResultSet rs = pst.executeQuery();
|
||||
|
||||
int total = 0;
|
||||
|
||||
rs.next();
|
||||
|
||||
this.scoreMax = rs.getInt(1);
|
||||
this.paysMax = rs.getString(2);
|
||||
|
||||
rs.close();
|
||||
pst.close();
|
||||
} catch (SQLException e3) {
|
||||
System.err.println("Erreur de syntaxe SQL.");
|
||||
}
|
||||
|
||||
cnx.close();
|
||||
} catch (SQLException e1) {
|
||||
System.err.println("Erreur de connexion à la base de données.");
|
||||
}
|
||||
}
|
||||
|
||||
public String getNomPays() {
|
||||
return this.paysMax;
|
||||
}
|
||||
|
||||
public int getScorePays() {
|
||||
return this.scoreMax;
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP01/02_Victoire/Fenetre.class
Normal file
BIN
DEV3.1/TP01/02_Victoire/Fenetre.class
Normal file
Binary file not shown.
43
DEV3.1/TP01/02_Victoire/Fenetre.java
Normal file
43
DEV3.1/TP01/02_Victoire/Fenetre.java
Normal file
@@ -0,0 +1,43 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Fenetre extends JFrame {
|
||||
|
||||
private String nomPays;
|
||||
private int scorePays;
|
||||
|
||||
public Fenetre(String nomPays, int scorePays) {
|
||||
this.nomPays = nomPays;
|
||||
this.scorePays = scorePays;
|
||||
|
||||
this.setSize(200, 200);
|
||||
this.setLocation(100, 100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setLayout(new BorderLayout());
|
||||
|
||||
JLabel pays = new JLabel(this.nomPays);
|
||||
JLabel score = new JLabel(this.scorePays + "");
|
||||
JPanel south = new JPanel();
|
||||
JButton refresh = new JButton("↻");
|
||||
|
||||
refresh.addActionListener(new Rafraichir(score, pays, this));
|
||||
|
||||
Font policeScore = new Font("Arial", Font.BOLD, 60);
|
||||
Font policePays = new Font("Arial", Font.BOLD, 40);
|
||||
|
||||
score.setFont(policeScore);
|
||||
pays.setFont(policePays);
|
||||
|
||||
pays.setHorizontalAlignment(JLabel.CENTER);
|
||||
score.setHorizontalAlignment(JLabel.CENTER);
|
||||
refresh.setHorizontalAlignment(JButton.RIGHT);
|
||||
|
||||
|
||||
this.add(pays, BorderLayout.NORTH);
|
||||
this.add(score, BorderLayout.CENTER);
|
||||
this.add(south, BorderLayout.SOUTH);
|
||||
south.setLayout(new BorderLayout());
|
||||
south.add(refresh, BorderLayout.EAST);
|
||||
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP01/02_Victoire/Main.class
Normal file
BIN
DEV3.1/TP01/02_Victoire/Main.class
Normal file
Binary file not shown.
7
DEV3.1/TP01/02_Victoire/Main.java
Normal file
7
DEV3.1/TP01/02_Victoire/Main.java
Normal file
@@ -0,0 +1,7 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Connexion cnx = new Connexion();
|
||||
Fenetre fenetre = new Fenetre(cnx.getNomPays(), cnx.getScorePays());
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP01/02_Victoire/Rafraichir.class
Normal file
BIN
DEV3.1/TP01/02_Victoire/Rafraichir.class
Normal file
Binary file not shown.
25
DEV3.1/TP01/02_Victoire/Rafraichir.java
Normal file
25
DEV3.1/TP01/02_Victoire/Rafraichir.java
Normal file
@@ -0,0 +1,25 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
public class Rafraichir implements ActionListener {
|
||||
|
||||
private JLabel texteScore;
|
||||
private JLabel textePays;
|
||||
private Fenetre fenetre;
|
||||
|
||||
public Rafraichir(JLabel texteScore, JLabel textePays, Fenetre fenetre) {
|
||||
this.texteScore = texteScore;
|
||||
this.textePays = textePays;
|
||||
this.fenetre = fenetre;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent evenement) {
|
||||
Connexion cnx2 = new Connexion();
|
||||
|
||||
this.texteScore.setText(cnx2.getScorePays() + "");
|
||||
this.textePays.setText(cnx2.getNomPays());
|
||||
this.fenetre.repaint();
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP02/01_Galerie/v1/Controlleur.class
Normal file
BIN
DEV3.1/TP02/01_Galerie/v1/Controlleur.class
Normal file
Binary file not shown.
52
DEV3.1/TP02/01_Galerie/v1/Controlleur.java
Normal file
52
DEV3.1/TP02/01_Galerie/v1/Controlleur.java
Normal file
@@ -0,0 +1,52 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
public class Controlleur implements MouseListener {
|
||||
|
||||
private JLabel img;
|
||||
private Fenetre fenetre;
|
||||
private String[] images;
|
||||
private int actuel;
|
||||
|
||||
public Controlleur(JLabel img, Fenetre fenetre) {
|
||||
this.img = img;
|
||||
this.fenetre = fenetre;
|
||||
String[] temp = {
|
||||
"img1.jpg",
|
||||
"img2.jpg",
|
||||
"img3.jpg",
|
||||
"img4.jpg"
|
||||
};
|
||||
|
||||
this.images = temp;
|
||||
this.actuel = 0;
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent evenement) {
|
||||
if (evenement.getX() < this.fenetre.getWidth()/2) {
|
||||
this.actuel--;
|
||||
if (this.actuel == -1) {
|
||||
this.actuel = 3;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.actuel++;
|
||||
if (this.actuel == 4) {
|
||||
this.actuel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
this.fenetre.getContentPane().removeAll();
|
||||
this.fenetre.add(new JLabel(new ImageIcon(this.images[this.actuel])));
|
||||
this.fenetre.revalidate();
|
||||
this.fenetre.repaint();
|
||||
} // un bouton cliqué
|
||||
|
||||
|
||||
public void mouseEntered(MouseEvent evenement) {} // debut du survol
|
||||
public void mouseExited(MouseEvent evenement) {} // fin du survol
|
||||
public void mousePressed(MouseEvent evenement) {} // un bouton appuyé
|
||||
public void mouseReleased(MouseEvent evenement) {} // un bouton relâché
|
||||
}
|
BIN
DEV3.1/TP02/01_Galerie/v1/Fenetre.class
Normal file
BIN
DEV3.1/TP02/01_Galerie/v1/Fenetre.class
Normal file
Binary file not shown.
18
DEV3.1/TP02/01_Galerie/v1/Fenetre.java
Normal file
18
DEV3.1/TP02/01_Galerie/v1/Fenetre.java
Normal file
@@ -0,0 +1,18 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class Fenetre extends JFrame {
|
||||
|
||||
public Fenetre() {
|
||||
this.setSize(900, 450);
|
||||
this.setLocation(100, 100);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
this.setLayout(new GridLayout(1, 1));
|
||||
|
||||
JLabel img = new JLabel(new ImageIcon("img1.jpg"));
|
||||
|
||||
this.add(img);
|
||||
this.addMouseListener(new Controlleur(img, this));
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP02/01_Galerie/v1/Main.class
Normal file
BIN
DEV3.1/TP02/01_Galerie/v1/Main.class
Normal file
Binary file not shown.
6
DEV3.1/TP02/01_Galerie/v1/Main.java
Normal file
6
DEV3.1/TP02/01_Galerie/v1/Main.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Fenetre fenetre = new Fenetre();
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP02/01_Galerie/v1/img1.jpg
Normal file
BIN
DEV3.1/TP02/01_Galerie/v1/img1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
BIN
DEV3.1/TP02/01_Galerie/v1/img2.jpg
Normal file
BIN
DEV3.1/TP02/01_Galerie/v1/img2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user