import java.awt.*; import javax.swing.*; public class Fenetre extends JFrame { public Fenetre() { this.setSize(900, 450); this.setLocation(100, 100); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); CardLayout layout = new CardLayout(); this.setLayout(layout); JLabel img1 = new JLabel(new ImageIcon("img1.jpg")); JLabel img2 = new JLabel(new ImageIcon("img2.jpg")); JLabel img3 = new JLabel(new ImageIcon("img3.jpg")); JLabel img4 = new JLabel(new ImageIcon("img4.jpg")); JLabel[] tableau = {img1, img2, img3, img4}; this.add(img1); this.add(img2); this.add(img3); this.add(img4); this.addMouseListener(new Controlleur(tableau, this, layout)); } }