This commit is contained in:
Adrian POURCHOT 2024-10-17 12:28:41 +02:00
parent ee94179c71
commit faa5da9fc7
44 changed files with 111 additions and 23 deletions

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -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();
}
}

View File

@ -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;
}
}

View File

@ -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){

View File

@ -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"));

View File

@ -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);
}
}

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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));
}
}

Binary file not shown.

View File

@ -0,0 +1,39 @@
import java.util.HashMap;
public class FibonacciRapide {
private static int indentation;
private static HashMap<Long, Long> 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));
}
}