diff --git a/DEV3.1/TP02/01_Galerie/v1/Controlleur.class b/DEV3.1/TP02/01_Galerie/v1/Controlleur.class index bfda2e0..af576e9 100644 Binary files a/DEV3.1/TP02/01_Galerie/v1/Controlleur.class and b/DEV3.1/TP02/01_Galerie/v1/Controlleur.class differ diff --git a/DEV3.1/TP02/01_Galerie/v1/Fenetre.class b/DEV3.1/TP02/01_Galerie/v1/Fenetre.class index bb6a26d..51a16d4 100644 Binary files a/DEV3.1/TP02/01_Galerie/v1/Fenetre.class and b/DEV3.1/TP02/01_Galerie/v1/Fenetre.class differ diff --git a/DEV3.1/TP02/01_Galerie/v1/Main.class b/DEV3.1/TP02/01_Galerie/v1/Main.class index 4bfefb8..0476717 100644 Binary files a/DEV3.1/TP02/01_Galerie/v1/Main.class and b/DEV3.1/TP02/01_Galerie/v1/Main.class differ diff --git a/DEV3.1/TP02/01_Galerie/v2/Controlleur.class b/DEV3.1/TP02/01_Galerie/v2/Controlleur.class index 718cfbf..49a7b0a 100644 Binary files a/DEV3.1/TP02/01_Galerie/v2/Controlleur.class and b/DEV3.1/TP02/01_Galerie/v2/Controlleur.class differ diff --git a/DEV3.1/TP02/01_Galerie/v2/Fenetre.class b/DEV3.1/TP02/01_Galerie/v2/Fenetre.class index 336ade5..576d570 100644 Binary files a/DEV3.1/TP02/01_Galerie/v2/Fenetre.class and b/DEV3.1/TP02/01_Galerie/v2/Fenetre.class differ diff --git a/DEV3.1/TP02/01_Galerie/v2/Main.class b/DEV3.1/TP02/01_Galerie/v2/Main.class index 4bfefb8..0476717 100644 Binary files a/DEV3.1/TP02/01_Galerie/v2/Main.class and b/DEV3.1/TP02/01_Galerie/v2/Main.class differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonNon.class b/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonNon.class new file mode 100644 index 0000000..d247ec0 Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonNon.class differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonNon.java b/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonNon.java new file mode 100644 index 0000000..6011848 --- /dev/null +++ b/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonNon.java @@ -0,0 +1,18 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + + +public class ControleurBoutonNon implements ActionListener { + + private JDialog fenetre; + + public ControleurBoutonNon(JDialog fenetre) { + this.fenetre = fenetre; + } + + public void actionPerformed(ActionEvent e) { + fenetre.dispose(); + } +} \ No newline at end of file diff --git a/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonOui.class b/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonOui.class new file mode 100644 index 0000000..684d7d1 Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonOui.class differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonOui.java b/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonOui.java new file mode 100644 index 0000000..9cd1393 --- /dev/null +++ b/DEV3.1/TP02/02_Confirmation/v1/ControleurBoutonOui.java @@ -0,0 +1,18 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + + +public class ControleurBoutonOui implements ActionListener { + + private JFrame fenetre; + + public ControleurBoutonOui(JFrame fenetre) { + this.fenetre = fenetre; + } + + public void actionPerformed(ActionEvent e) { + this.fenetre.dispose(); + } +} \ No newline at end of file diff --git a/DEV3.1/TP02/02_Confirmation/v1/ControleurFenetre.class b/DEV3.1/TP02/02_Confirmation/v1/ControleurFenetre.class new file mode 100644 index 0000000..69a3719 Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/ControleurFenetre.class differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/ControleurFenetre.java b/DEV3.1/TP02/02_Confirmation/v1/ControleurFenetre.java new file mode 100644 index 0000000..477f402 --- /dev/null +++ b/DEV3.1/TP02/02_Confirmation/v1/ControleurFenetre.java @@ -0,0 +1,43 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.WindowListener; +import java.awt.event.WindowEvent; + +public class ControleurFenetre implements WindowListener { + + private JFrame fenetre; + + public ControleurFenetre(JFrame fenetre) { + this.fenetre = fenetre; + } + + + public void windowClosing(WindowEvent evenement){ + JDialog fermeture = new JDialog(this.fenetre, "Fermeture"); + fermeture.setLayout(new BorderLayout()); + JLabel texte = new JLabel("Voulez-vous vraiment quitter ?"); + texte.setHorizontalAlignment(JLabel.CENTER); + fermeture.add(texte, BorderLayout.CENTER); + JPanel panneau = new JPanel(); + panneau.setLayout(new FlowLayout()); + JButton oui = new JButton("Oui"); + oui.addActionListener(new ControleurBoutonOui(this.fenetre)); + JButton non = new JButton("Non"); + non.addActionListener(new ControleurBoutonNon(fermeture)); + panneau.add(oui); + panneau.add(non); + fermeture.add(panneau, BorderLayout.SOUTH); + fermeture.setLocation(400, 275); + fermeture.setSize(300, 100); + fermeture.setVisible(true); + } // avant fermeture + + + + public void windowActivated(WindowEvent evenement) {} // premier plan + public void windowClosed(WindowEvent evenement){} // après fermeture + public void windowDeactivated(WindowEvent evenement){} // arrière-plan + public void windowDeiconified(WindowEvent evenement){} // restauration + public void windowIconified(WindowEvent evenement){} // minimisation + public void windowOpened(WindowEvent evenement){} // après ouverture +} \ No newline at end of file diff --git a/DEV3.1/TP02/02_Confirmation/v1/Controlleur.class b/DEV3.1/TP02/02_Confirmation/v1/Controlleur.class new file mode 100644 index 0000000..af576e9 Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/Controlleur.class differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/Controlleur.java b/DEV3.1/TP02/02_Confirmation/v1/Controlleur.java new file mode 100644 index 0000000..a47ba8b --- /dev/null +++ b/DEV3.1/TP02/02_Confirmation/v1/Controlleur.java @@ -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é +} \ No newline at end of file diff --git a/DEV3.1/TP02/02_Confirmation/v1/Fenetre.class b/DEV3.1/TP02/02_Confirmation/v1/Fenetre.class new file mode 100644 index 0000000..6090126 Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/Fenetre.class differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/Fenetre.java b/DEV3.1/TP02/02_Confirmation/v1/Fenetre.java new file mode 100644 index 0000000..1e7c5a0 --- /dev/null +++ b/DEV3.1/TP02/02_Confirmation/v1/Fenetre.java @@ -0,0 +1,19 @@ +import java.awt.*; +import javax.swing.*; + +public class Fenetre extends JFrame { + + public Fenetre() { + this.setSize(900, 450); + this.setLocation(100, 100); + this.setDefaultCloseOperation(JFrame.DO_NOTHING_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)); + this.addWindowListener(new ControleurFenetre(this)); + } +} \ No newline at end of file diff --git a/DEV3.1/TP02/02_Confirmation/v1/Main.class b/DEV3.1/TP02/02_Confirmation/v1/Main.class new file mode 100644 index 0000000..0476717 Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/Main.class differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/Main.java b/DEV3.1/TP02/02_Confirmation/v1/Main.java new file mode 100644 index 0000000..2768c3d --- /dev/null +++ b/DEV3.1/TP02/02_Confirmation/v1/Main.java @@ -0,0 +1,6 @@ +public class Main { + public static void main(String[] args) { + Fenetre fenetre = new Fenetre(); + fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV3.1/TP02/02_Confirmation/v1/img1.jpg b/DEV3.1/TP02/02_Confirmation/v1/img1.jpg new file mode 100644 index 0000000..f06261b Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/img1.jpg differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/img2.jpg b/DEV3.1/TP02/02_Confirmation/v1/img2.jpg new file mode 100644 index 0000000..cf60dd2 Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/img2.jpg differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/img3.jpg b/DEV3.1/TP02/02_Confirmation/v1/img3.jpg new file mode 100644 index 0000000..8a825b8 Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/img3.jpg differ diff --git a/DEV3.1/TP02/02_Confirmation/v1/img4.jpg b/DEV3.1/TP02/02_Confirmation/v1/img4.jpg new file mode 100644 index 0000000..05fd9f7 Binary files /dev/null and b/DEV3.1/TP02/02_Confirmation/v1/img4.jpg differ diff --git a/DEV3.1/TP03/01_Boutons/Fenetre.class b/DEV3.1/TP03/01_Boutons/Fenetre.class index 1b343d2..8fd80ee 100644 Binary files a/DEV3.1/TP03/01_Boutons/Fenetre.class and b/DEV3.1/TP03/01_Boutons/Fenetre.class differ diff --git a/DEV3.1/TP03/01_Boutons/Main.class b/DEV3.1/TP03/01_Boutons/Main.class index 4bfefb8..0476717 100644 Binary files a/DEV3.1/TP03/01_Boutons/Main.class and b/DEV3.1/TP03/01_Boutons/Main.class differ diff --git a/DEV3.1/TP03/01_Boutons/WindowControler.class b/DEV3.1/TP03/01_Boutons/WindowControler.class index 4a36fc6..eca55bd 100644 Binary files a/DEV3.1/TP03/01_Boutons/WindowControler.class and b/DEV3.1/TP03/01_Boutons/WindowControler.class differ diff --git a/DEV3.1/TP03/02_Tableau/Donnees.class b/DEV3.1/TP03/02_Tableau/Donnees.class new file mode 100644 index 0000000..2197b4a Binary files /dev/null and b/DEV3.1/TP03/02_Tableau/Donnees.class differ diff --git a/DEV3.1/TP03/02_Tableau/Donnees.java b/DEV3.1/TP03/02_Tableau/Donnees.java new file mode 100644 index 0000000..5885c84 --- /dev/null +++ b/DEV3.1/TP03/02_Tableau/Donnees.java @@ -0,0 +1,114 @@ +import org.mariadb.jdbc.*; +import java.awt.*; +import java.sql.*; + +public class Donnees { + + private String[] modules; + private String[] champs; + private int[] idChamps; + + public Donnees() { + // FAIRE UN TABLEAU PAR TABLE DE LA BASE DE DONNEES AU LIEU DE RASSEMBLER LES DEUX + + 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 { + + // QUERY 1 + PreparedStatement pst = cnx.prepareStatement( + "SELECT * FROM module;" + ); + + ResultSet rs = pst.executeQuery(); + + rs.last(); + + this.modules = new String[rs.getInt(1)]; + + rs.first(); + + int i = 0; + this.modules[i] = rs.getString(2); + + while (rs.next()) { + i++; + this.modules[i] = rs.getString(2); + } + + rs.close(); + pst.close(); + + // QUERY 2 + + PreparedStatement pst2 = cnx.prepareStatement( + "SELECT COUNT(*) FROM champ;" + ); + + ResultSet rs2 = pst2.executeQuery(); + + rs2.last(); + + this.idChamps = new int[rs2.getInt(1)]; + this.champs = new String[rs2.getInt(1)]; + + rs2.close(); + pst2.close(); + + // QUERY 3 + PreparedStatement pst3 = cnx.prepareStatement( + "SELECT * FROM champ;" + ); + + ResultSet rs3 = pst3.executeQuery(); + + i = 0; + + while (rs3.next()) { + this.idChamps[i] = rs3.getInt(1); + this.champs[i] = rs3.getString(2); + i++; + } + + for (i = 0; i != this.champs.length; i++) { + System.out.println(this.idChamps[i] + " | " + this.champs[i]); + } + + rs3.close(); + pst3.close(); + + // TODO + + } 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[] getModules() { + return this.modules; + } + + public int[] getIdChamps() { + return this.idChamps; + } + + public String[] getChamps() { + return this.champs; + } +} \ No newline at end of file diff --git a/DEV3.1/TP03/02_Tableau/Fenetre.class b/DEV3.1/TP03/02_Tableau/Fenetre.class new file mode 100644 index 0000000..1bf7154 Binary files /dev/null and b/DEV3.1/TP03/02_Tableau/Fenetre.class differ diff --git a/DEV3.1/TP03/02_Tableau/Fenetre.java b/DEV3.1/TP03/02_Tableau/Fenetre.java new file mode 100644 index 0000000..9f632d9 --- /dev/null +++ b/DEV3.1/TP03/02_Tableau/Fenetre.java @@ -0,0 +1,77 @@ +import java.awt.*; +import javax.swing.*; +import java.util.Arrays; + +public class Fenetre extends JFrame { + + private String[] modules; + private String[] champs; + private int[] idChamps; + + public Fenetre(String[] modules, String[] champs, int[] idChamps) { + this.modules = modules; + this.champs = champs; + this.idChamps = idChamps; + + int[] nbChampsParModule = new int[this.modules.length]; + + Arrays.fill(nbChampsParModule, 0); + + int indexIdChamps = 0; + + for (int i = 0; i != this.modules.length; i++) { + while ((indexIdChamps < this.idChamps.length) && this.idChamps[indexIdChamps] == (i+1)) { + nbChampsParModule[i]++; + indexIdChamps++; + } + System.out.println(nbChampsParModule[i]); + } + + System.out.println(Arrays.toString(nbChampsParModule)); + + this.setSize(200, 500); + this.setLocation(100, 100); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + this.setLayout(new GridBagLayout()); + + + GridBagConstraints gbc = new GridBagConstraints(); + + + gbc.gridx = 0; + gbc.gridy = 0; + gbc.fill = GridBagConstraints.BOTH; // Make the component fill its display area entirely + gbc.gridwidth = 1; + gbc.weightx = 1.0; + gbc.weighty = 1.0; + + + for (int i = 0; i != this.modules.length; i++) { + gbc.gridheight = nbChampsParModule[i]; + JLabel texte = new JLabel(this.modules[i]); + texte.setBorder(BorderFactory.createLineBorder(Color.BLACK)); + texte.setHorizontalAlignment(JLabel.CENTER); + texte.setVerticalAlignment(JLabel.CENTER); + this.add(texte, gbc); + gbc.gridy += nbChampsParModule[i]; + } + + gbc.gridx = 1; + gbc.gridheight = 1; + + + for (int i = 0; i != this.champs.length; i++) { + gbc.gridy = i; + JLabel texte = new JLabel(this.champs[i]); + texte.setBorder(BorderFactory.createLineBorder(Color.BLACK)); + texte.setHorizontalAlignment(JLabel.CENTER); + texte.setVerticalAlignment(JLabel.CENTER); + this.add(texte, gbc); + } + + + } + + +} \ No newline at end of file diff --git a/DEV3.1/TP03/02_Tableau/Main.class b/DEV3.1/TP03/02_Tableau/Main.class new file mode 100644 index 0000000..13ca315 Binary files /dev/null and b/DEV3.1/TP03/02_Tableau/Main.class differ diff --git a/DEV3.1/TP03/02_Tableau/Main.java b/DEV3.1/TP03/02_Tableau/Main.java new file mode 100644 index 0000000..cf896f6 --- /dev/null +++ b/DEV3.1/TP03/02_Tableau/Main.java @@ -0,0 +1,8 @@ +public class Main { + public static void main(String[] args) { + Donnees donnees = new Donnees(); + Fenetre fenetre = new Fenetre(donnees.getModules(), donnees.getChamps(), donnees.getIdChamps()); + fenetre.setVisible(true); + } +} +