20 Septembre

This commit is contained in:
2023-09-20 11:29:37 +02:00
parent 2da42fcdcc
commit 7f2d998310
28 changed files with 804 additions and 1 deletions

Binary file not shown.

View File

@@ -0,0 +1,23 @@
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class Changement{
static public void fenetreCliquer(int LR){
Main.pan.remove(Listeimage.liste[Listeimage.index]);
if (LR==1){
Listeimage.index+=1;
if(Listeimage.index==-1){
Listeimage.index=5;
}
}else {
Listeimage.index-=1;
if(Listeimage.index==6){
Listeimage.index=0;
}
}
Main.pan.add(Listeimage.liste[Listeimage.index]);
Main.pan.repaint();
}
}

Binary file not shown.

View File

@@ -0,0 +1,32 @@
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class Galerie extends JPanel implements MouseListener{
public Galerie(){
super();
}
public void mouseClicked(MouseEvent e){
int x = e.getX();
if (x <= this.getWidth()/5){
Changement.fenetreCliquer(0);
}else if(x >= (this.getWidth()/5)*4){
Changement.fenetreCliquer(1);
}
}
public void mouseEntered(MouseEvent evenement){
}
public void mouseExited(MouseEvent evenement){
}
public void mousePressed(MouseEvent evenement){
}
public void mouseReleased(MouseEvent evenement){
}
}

Binary file not shown.

View File

@@ -0,0 +1,15 @@
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class Listeimage{
static JLabel image1 = new JLabel(new ImageIcon("image1.jpg"));
static JLabel image2 = new JLabel(new ImageIcon("image2.jpg"));
static JLabel image3 = new JLabel(new ImageIcon("image3.jpg"));
static JLabel image4 = new JLabel(new ImageIcon("image4.jpg"));
static JLabel image5 = new JLabel(new ImageIcon("image5.jpg"));
static JLabel[] liste = {image1, image2, image3, image4, image5};
static int index=0;
}

Binary file not shown.

View File

@@ -0,0 +1,20 @@
import java.awt.*;
import javax.swing.*;
import java.util.*;
public class Main{
static JFrame fenetre = new JFrame();
static Galerie pan = new Galerie();
public static void main(String[] args) {
pan.add(Listeimage.image1);
fenetre.setSize(250, 250);
fenetre.setLocation(250, 250);
fenetre.addMouseListener(pan);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.setContentPane(pan);
fenetre.setVisible(true);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB