TP
This commit is contained in:
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Changement.class
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Changement.class
Normal file
Binary file not shown.
29
DEV3.1/TP2:Transitions/GalerieConfirmation/Changement.java
Normal file
29
DEV3.1/TP2:Transitions/GalerieConfirmation/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.fenetre.pan);
|
||||
Main.fenetre.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.fenetre.pan.add(Listeimage.liste[Listeimage.index]);
|
||||
Main.fenetre.setContentPane(Main.fenetre.pan);
|
||||
Main.fenetre.revalidate();
|
||||
}
|
||||
}
|
||||
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre$1.class
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre$1.class
Normal file
Binary file not shown.
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre.class
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre.class
Normal file
Binary file not shown.
45
DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre.java
Normal file
45
DEV3.1/TP2:Transitions/GalerieConfirmation/Fenetre.java
Normal 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;
|
||||
}
|
||||
}
|
||||
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Galerie.class
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Galerie.class
Normal file
Binary file not shown.
36
DEV3.1/TP2:Transitions/GalerieConfirmation/Galerie.java
Normal file
36
DEV3.1/TP2:Transitions/GalerieConfirmation/Galerie.java
Normal file
@@ -0,0 +1,36 @@
|
||||
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();
|
||||
}
|
||||
|
||||
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/GalerieConfirmation/Listeimage.class
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Listeimage.class
Normal file
Binary file not shown.
18
DEV3.1/TP2:Transitions/GalerieConfirmation/Listeimage.java
Normal file
18
DEV3.1/TP2:Transitions/GalerieConfirmation/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/GalerieConfirmation/Main.class
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/Main.class
Normal file
Binary file not shown.
14
DEV3.1/TP2:Transitions/GalerieConfirmation/Main.java
Normal file
14
DEV3.1/TP2:Transitions/GalerieConfirmation/Main.java
Normal file
@@ -0,0 +1,14 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
public class Main{
|
||||
|
||||
static Fenetre fenetre = new Fenetre();
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image1.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image2.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image3.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image4.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image4.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image5.jpg
Normal file
BIN
DEV3.1/TP2:Transitions/GalerieConfirmation/img/image5.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
Reference in New Issue
Block a user