diff --git a/DEV3.1/TP2:Transitions/Confirmation/Changement.class b/DEV3.1/TP2:Transitions/GalerieConfirmation/Changement.class similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Changement.class rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Changement.class diff --git a/DEV3.1/TP2:Transitions/Confirmation/Changement.java b/DEV3.1/TP2:Transitions/GalerieConfirmation/Changement.java similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Changement.java rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Changement.java diff --git a/DEV3.1/TP2:Transitions/Confirmation/Fenetre$1.class b/DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre$1.class similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Fenetre$1.class rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre$1.class diff --git a/DEV3.1/TP2:Transitions/Confirmation/Fenetre.class b/DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre.class similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Fenetre.class rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre.class diff --git a/DEV3.1/TP2:Transitions/Confirmation/Fenetre.java b/DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre.java similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Fenetre.java rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre.java diff --git a/DEV3.1/TP2:Transitions/Confirmation/Galerie.class b/DEV3.1/TP2:Transitions/GalerieConfirmation/Galerie.class similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Galerie.class rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Galerie.class diff --git a/DEV3.1/TP2:Transitions/Confirmation/Galerie.java b/DEV3.1/TP2:Transitions/GalerieConfirmation/Galerie.java similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Galerie.java rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Galerie.java diff --git a/DEV3.1/TP2:Transitions/Confirmation/Listeimage.class b/DEV3.1/TP2:Transitions/GalerieConfirmation/Listeimage.class similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Listeimage.class rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Listeimage.class diff --git a/DEV3.1/TP2:Transitions/Confirmation/Listeimage.java b/DEV3.1/TP2:Transitions/GalerieConfirmation/Listeimage.java similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Listeimage.java rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Listeimage.java diff --git a/DEV3.1/TP2:Transitions/Confirmation/Main.class b/DEV3.1/TP2:Transitions/GalerieConfirmation/Main.class similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Main.class rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Main.class diff --git a/DEV3.1/TP2:Transitions/Confirmation/Main.java b/DEV3.1/TP2:Transitions/GalerieConfirmation/Main.java similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/Main.java rename to DEV3.1/TP2:Transitions/GalerieConfirmation/Main.java diff --git a/DEV3.1/TP2:Transitions/Confirmation/img/image1.jpg b/DEV3.1/TP2:Transitions/GalerieConfirmation/img/image1.jpg similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/img/image1.jpg rename to DEV3.1/TP2:Transitions/GalerieConfirmation/img/image1.jpg diff --git a/DEV3.1/TP2:Transitions/Confirmation/img/image2.jpg b/DEV3.1/TP2:Transitions/GalerieConfirmation/img/image2.jpg similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/img/image2.jpg rename to DEV3.1/TP2:Transitions/GalerieConfirmation/img/image2.jpg diff --git a/DEV3.1/TP2:Transitions/Confirmation/img/image3.jpg b/DEV3.1/TP2:Transitions/GalerieConfirmation/img/image3.jpg similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/img/image3.jpg rename to DEV3.1/TP2:Transitions/GalerieConfirmation/img/image3.jpg diff --git a/DEV3.1/TP2:Transitions/Confirmation/img/image4.jpg b/DEV3.1/TP2:Transitions/GalerieConfirmation/img/image4.jpg similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/img/image4.jpg rename to DEV3.1/TP2:Transitions/GalerieConfirmation/img/image4.jpg diff --git a/DEV3.1/TP2:Transitions/Confirmation/img/image5.jpg b/DEV3.1/TP2:Transitions/GalerieConfirmation/img/image5.jpg similarity index 100% rename from DEV3.1/TP2:Transitions/Confirmation/img/image5.jpg rename to DEV3.1/TP2:Transitions/GalerieConfirmation/img/image5.jpg diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/Changement.class b/DEV3.1/TP4:OrganisationCode/Galerie/Changement.class deleted file mode 100644 index 5c8e05d..0000000 Binary files a/DEV3.1/TP4:OrganisationCode/Galerie/Changement.class and /dev/null differ diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/Galerie.class b/DEV3.1/TP4:OrganisationCode/Galerie/Galerie.class deleted file mode 100644 index fb14a7f..0000000 Binary files a/DEV3.1/TP4:OrganisationCode/Galerie/Galerie.class and /dev/null differ diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/Listeimage.class b/DEV3.1/TP4:OrganisationCode/Galerie/Listeimage.class deleted file mode 100644 index d7f0963..0000000 Binary files a/DEV3.1/TP4:OrganisationCode/Galerie/Listeimage.class and /dev/null differ diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/Main.class b/DEV3.1/TP4:OrganisationCode/Galerie/Main.class deleted file mode 100644 index 7eda3c6..0000000 Binary files a/DEV3.1/TP4:OrganisationCode/Galerie/Main.class and /dev/null differ diff --git a/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Changement.class b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Changement.class new file mode 100644 index 0000000..8169958 Binary files /dev/null and b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Changement.class differ diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/Changement.java b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Changement.java similarity index 70% rename from DEV3.1/TP4:OrganisationCode/Galerie/Changement.java rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Changement.java index f6accfa..2b4d580 100644 --- a/DEV3.1/TP4:OrganisationCode/Galerie/Changement.java +++ b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Changement.java @@ -9,8 +9,8 @@ public class Changement{ InputStream file = loader.getResourceAsStream("Main.java"); InputStream file2 = loader.getResourceAsStream("Listeimage.java"); static public void fenetreCliquer(int LR){ - Main.fenetre.remove(Main.pan); - Main.pan.remove(Listeimage.liste[Listeimage.index]); + Main.fenetre.remove(Main.fenetre.pan); + Main.fenetre.pan.remove(Listeimage.liste[Listeimage.index]); if (LR==1){ Listeimage.index=Listeimage.index+1; if(Listeimage.index>4){ @@ -22,8 +22,8 @@ public class Changement{ Listeimage.index=4; } } - Main.pan.add(Listeimage.liste[Listeimage.index]); - Main.fenetre.setContentPane(Main.pan); - Main.fenetre.repaint(); + Main.fenetre.pan.add(Listeimage.liste[Listeimage.index]); + Main.fenetre.setContentPane(Main.fenetre.pan); + Main.fenetre.revalidate(); } } \ No newline at end of file diff --git a/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Fenetre$1.class b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Fenetre$1.class new file mode 100644 index 0000000..6bcd67a Binary files /dev/null and b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Fenetre$1.class differ diff --git a/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Fenetre.class b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Fenetre.class new file mode 100644 index 0000000..490b616 Binary files /dev/null and b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Fenetre.class differ diff --git a/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Fenetre.java b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Fenetre.java new file mode 100644 index 0000000..014c756 --- /dev/null +++ b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Fenetre.java @@ -0,0 +1,45 @@ +import java.awt.*; +import javax.swing.*; +import java.awt.event.*; +import java.util.*; +import java.io.*; + +public class Fenetre extends JFrame{ + + static Galerie pan = new Galerie(); + private ClassLoader loader = Thread.currentThread().getContextClassLoader(); + private InputStream file = loader.getResourceAsStream("Galerie.java"); + + public Fenetre(){ + pan.add(Listeimage.liste[Listeimage.index]); + this.setSize(250, 250); + this.setLocation(500, 500); + this.addMouseListener(pan); + this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + this.setContentPane(pan); + + addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + if(fermerFenetre()==true){ + dispose(); + System.exit(0); + } + return; + } + }); + } + + private boolean fermerFenetre() { + JOptionPane option = new JOptionPane("Voulez-vous vraiment quitter ce programme ?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION); + JDialog confirmation = option.createDialog(this, "Confirmation de fermeture"); + + confirmation.setSize(400, 120); + confirmation.setLocation(450, 550); + confirmation.setVisible(true); + int result = (int) option.getValue(); + confirmation.dispose(); + return result == JOptionPane.YES_OPTION; + } +} diff --git a/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Galerie.class b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Galerie.class new file mode 100644 index 0000000..e4ef236 Binary files /dev/null and b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Galerie.class differ diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/Galerie.java b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Galerie.java similarity index 95% rename from DEV3.1/TP4:OrganisationCode/Galerie/Galerie.java rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Galerie.java index 9260e69..94b4cdd 100644 --- a/DEV3.1/TP4:OrganisationCode/Galerie/Galerie.java +++ b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Galerie.java @@ -9,10 +9,6 @@ public class Galerie extends JPanel implements MouseListener{ ClassLoader loader = Thread.currentThread().getContextClassLoader(); InputStream file = loader.getResourceAsStream("Changement.java"); - public Galerie(){ - super(); - } - public void mouseClicked(MouseEvent e){ int x = e.getX(); if (x <= this.getWidth()/5){ diff --git a/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Listeimage.class b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Listeimage.class new file mode 100644 index 0000000..2e7eef4 Binary files /dev/null and b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Listeimage.class differ diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/Listeimage.java b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Listeimage.java similarity index 65% rename from DEV3.1/TP4:OrganisationCode/Galerie/Listeimage.java rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Listeimage.java index b2ee998..1209bb6 100644 --- a/DEV3.1/TP4:OrganisationCode/Galerie/Listeimage.java +++ b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Listeimage.java @@ -7,11 +7,6 @@ import java.io.*; public class Listeimage{ ClassLoader loader = Thread.currentThread().getContextClassLoader(); - InputStream file = loader.getResourceAsStream("img/image1.jpg"); - InputStream file2 = loader.getResourceAsStream("img/image2.jpg"); - InputStream file3 = loader.getResourceAsStream("img/image3.jpg"); - InputStream file4 = loader.getResourceAsStream("img/image4.jpg"); - InputStream file5 = loader.getResourceAsStream("img/image5.jpg"); static JLabel image1 = new JLabel(new ImageIcon("./img/image1.jpg")); static JLabel image2 = new JLabel(new ImageIcon("./img/image2.jpg")); diff --git a/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Main.class b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Main.class new file mode 100644 index 0000000..fa6c2de Binary files /dev/null and b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Main.class differ diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/Main.java b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Main.java similarity index 58% rename from DEV3.1/TP4:OrganisationCode/Galerie/Main.java rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Main.java index 2ca8688..d4af523 100644 --- a/DEV3.1/TP4:OrganisationCode/Galerie/Main.java +++ b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/Main.java @@ -4,22 +4,16 @@ import java.util.*; import java.io.*; public class Main{ - - static JFrame fenetre = new JFrame(); - static Galerie pan = new Galerie(); + ClassLoader loader = Thread.currentThread().getContextClassLoader(); InputStream file = loader.getResourceAsStream("Galerie.java"); InputStream file2 = loader.getResourceAsStream("Listeimage.java"); InputStream file3 = loader.getResourceAsStream("Changement.java"); + InputStream file4 = loader.getResourceAsStream("Fenetre.java"); + static Fenetre fenetre = new Fenetre(); public static void main(String[] args) { - pan.add(Listeimage.liste[Listeimage.index]); - fenetre.setSize(250, 250); - fenetre.setLocation(250, 250); - fenetre.addMouseListener(pan); - fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - fenetre.setContentPane(pan); fenetre.setVisible(true); } } \ No newline at end of file diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/galerie.jar b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/galerie.jar similarity index 82% rename from DEV3.1/TP4:OrganisationCode/Galerie/galerie.jar rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/galerie.jar index a74d067..bc35a0f 100644 Binary files a/DEV3.1/TP4:OrganisationCode/Galerie/galerie.jar and b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/galerie.jar differ diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/img/image1.jpg b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image1.jpg similarity index 100% rename from DEV3.1/TP4:OrganisationCode/Galerie/img/image1.jpg rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image1.jpg diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/img/image2.jpg b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image2.jpg similarity index 100% rename from DEV3.1/TP4:OrganisationCode/Galerie/img/image2.jpg rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image2.jpg diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/img/image3.jpg b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image3.jpg similarity index 100% rename from DEV3.1/TP4:OrganisationCode/Galerie/img/image3.jpg rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image3.jpg diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/img/image4.jpg b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image4.jpg similarity index 100% rename from DEV3.1/TP4:OrganisationCode/Galerie/img/image4.jpg rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image4.jpg diff --git a/DEV3.1/TP4:OrganisationCode/Galerie/img/image5.jpg b/DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image5.jpg similarity index 100% rename from DEV3.1/TP4:OrganisationCode/Galerie/img/image5.jpg rename to DEV3.1/TP4:OrganisationCode/GalerieConfirmation/img/image5.jpg diff --git a/DEV3.1/TP4:OrganisationCode/galerie.jar b/DEV3.1/TP4:OrganisationCode/galerie.jar new file mode 100644 index 0000000..de6c72c Binary files /dev/null and b/DEV3.1/TP4:OrganisationCode/galerie.jar differ diff --git a/DEV3.2/TP1/Tableaux/Main$1.class b/DEV3.2/TP1/Tableaux/Main$1.class index 57caa2d..6f24a0e 100644 Binary files a/DEV3.2/TP1/Tableaux/Main$1.class and b/DEV3.2/TP1/Tableaux/Main$1.class differ diff --git a/DEV3.2/TP1/Tableaux/Main.class b/DEV3.2/TP1/Tableaux/Main.class index 7eb99d3..d58299e 100644 Binary files a/DEV3.2/TP1/Tableaux/Main.class and b/DEV3.2/TP1/Tableaux/Main.class differ diff --git a/DEV3.2/TP2/FibonacciLent.class b/DEV3.2/TP2/FibonacciLent.class new file mode 100644 index 0000000..c0809b8 Binary files /dev/null and b/DEV3.2/TP2/FibonacciLent.class differ diff --git a/DEV3.2/TP2/FibonacciLent.java b/DEV3.2/TP2/FibonacciLent.java new file mode 100644 index 0000000..8cc56db --- /dev/null +++ b/DEV3.2/TP2/FibonacciLent.java @@ -0,0 +1,19 @@ +public class FibonacciLent{ + + public static long fibo(long indice){ + if(indice==0){ + return 0; + } + else if(indice==1){ + return 1; + } + else{ + return fibo(indice-1)+fibo(indice-2); + } + } + + public static void main(String args[]){ + long indicemax=Long.parseUnsignedLong(args[0]); + System.out.println("Le terme n°"+indicemax+" de la suite de Fibonacci est égal à "+fibo(indicemax)); + } +} \ No newline at end of file diff --git a/DEV3.2/TP2/FibonacciRapide.class b/DEV3.2/TP2/FibonacciRapide.class new file mode 100644 index 0000000..2ac5ecf Binary files /dev/null and b/DEV3.2/TP2/FibonacciRapide.class differ diff --git a/DEV3.2/TP2/FibonacciRapide.java b/DEV3.2/TP2/FibonacciRapide.java new file mode 100644 index 0000000..3e9b402 --- /dev/null +++ b/DEV3.2/TP2/FibonacciRapide.java @@ -0,0 +1,39 @@ +import java.util.HashMap; + +public class FibonacciRapide { + + private static int indentation; + private static HashMap buffer = new HashMap<>(); + + public static long fibo(long indice) { + if (indice == 0) { + return 0; + } else if (indice == 1) { + return 1; + } else { + if (buffer.containsKey(indice)) { + return buffer.get(indice); + } + for (int i = 0; i < indentation; i++) { + System.out.print(" "); + } + System.out.println("Terme n°"+indice); + indentation++; + long result = fibo(indice - 1) + fibo(indice - 2); + buffer.put(indice, result); + for (int i = 0; i < indentation-1; i++) { + System.out.print(" "); + } + indentation--; + System.out.println("Résultat du calcul: "+result); + + return result; + } + } + + public static void main(String args[]) { + long indicemax = Long.parseUnsignedLong(args[0]); + indentation=0; + System.out.println("Le terme n°" + indicemax + " de la suite de Fibonacci est égal à " + fibo(indicemax)); + } +}