5 Octobre
BIN
DEV3.1/TP2:Transitions/Changement.class
Normal file
29
DEV3.1/TP2:Transitions/Changement.java
Normal file
@@ -0,0 +1,29 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
public class Changement{
|
||||
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
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]);
|
||||
if (LR==1){
|
||||
Listeimage.index=Listeimage.index+1;
|
||||
if(Listeimage.index>4){
|
||||
Listeimage.index=0;
|
||||
}
|
||||
}else {
|
||||
Listeimage.index=Listeimage.index-1;
|
||||
if(Listeimage.index<0){
|
||||
Listeimage.index=4;
|
||||
}
|
||||
}
|
||||
Main.pan.add(Listeimage.liste[Listeimage.index]);
|
||||
Main.fenetre.setContentPane(Main.pan);
|
||||
Main.fenetre.repaint();
|
||||
}
|
||||
}
|
||||
BIN
DEV3.1/TP2:Transitions/Galerie.class
Normal file
@@ -2,9 +2,13 @@ import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
public class Galerie extends JPanel implements MouseListener{
|
||||
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
InputStream file = loader.getResourceAsStream("Changement.java");
|
||||
|
||||
public Galerie(){
|
||||
super();
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
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/Listeimage.class
Normal file
18
DEV3.1/TP2:Transitions/Listeimage.java
Normal file
@@ -0,0 +1,18 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
public class Listeimage{
|
||||
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
|
||||
static JLabel image1 = new JLabel(new ImageIcon("./img/image1.jpg"));
|
||||
static JLabel image2 = new JLabel(new ImageIcon("./img/image2.jpg"));
|
||||
static JLabel image3 = new JLabel(new ImageIcon("./img/image3.jpg"));
|
||||
static JLabel image4 = new JLabel(new ImageIcon("./img/image4.jpg"));
|
||||
static JLabel image5 = new JLabel(new ImageIcon("./img/image5.jpg"));
|
||||
static JLabel[] liste = {image1, image2, image3, image4, image5};
|
||||
static int index=0;
|
||||
}
|
||||
BIN
DEV3.1/TP2:Transitions/Main.class
Normal file
@@ -1,15 +1,18 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
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");
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
pan.add(Listeimage.image1);
|
||||
pan.add(Listeimage.liste[Listeimage.index]);
|
||||
fenetre.setSize(250, 250);
|
||||
fenetre.setLocation(250, 250);
|
||||
fenetre.addMouseListener(pan);
|
||||
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |