20 Septembre
This commit is contained in:
BIN
DEV3.1/TP2:Transitions/Galerie/Changement.class
Normal file
BIN
DEV3.1/TP2:Transitions/Galerie/Changement.class
Normal file
Binary file not shown.
23
DEV3.1/TP2:Transitions/Galerie/Changement.java
Normal file
23
DEV3.1/TP2:Transitions/Galerie/Changement.java
Normal 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();
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP2:Transitions/Galerie/Galerie.class
Normal file
BIN
DEV3.1/TP2:Transitions/Galerie/Galerie.class
Normal file
Binary file not shown.
32
DEV3.1/TP2:Transitions/Galerie/Galerie.java
Normal file
32
DEV3.1/TP2:Transitions/Galerie/Galerie.java
Normal 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){
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP2:Transitions/Galerie/Listeimage.class
Normal file
BIN
DEV3.1/TP2:Transitions/Galerie/Listeimage.class
Normal file
Binary file not shown.
15
DEV3.1/TP2:Transitions/Galerie/Listeimage.java
Normal file
15
DEV3.1/TP2:Transitions/Galerie/Listeimage.java
Normal 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;
|
||||
}
|
BIN
DEV3.1/TP2:Transitions/Galerie/Main.class
Normal file
BIN
DEV3.1/TP2:Transitions/Galerie/Main.class
Normal file
Binary file not shown.
20
DEV3.1/TP2:Transitions/Galerie/Main.java
Normal file
20
DEV3.1/TP2:Transitions/Galerie/Main.java
Normal 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);
|
||||
}
|
||||
}
|
BIN
DEV3.1/TP2:Transitions/Galerie/image1.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/Galerie/image1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
BIN
DEV3.1/TP2:Transitions/Galerie/image2.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/Galerie/image2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
BIN
DEV3.1/TP2:Transitions/Galerie/image3.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/Galerie/image3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.3 KiB |
BIN
DEV3.1/TP2:Transitions/Galerie/image4.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/Galerie/image4.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
DEV3.1/TP2:Transitions/Galerie/image5.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/Galerie/image5.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
Reference in New Issue
Block a user