import javax.swing.*; public class GModel { private ImageIcon[] imgCarousel; private int index; public GModel(ImageIcon[] imgCarousel) { this.imgCarousel = imgCarousel; this.index = 0; } public ImageIcon getImageActuel() { return this.imgCarousel[this.index]; } public void imageSuivante() { this.index = (this.index + 1) % imgCarousel.length; } public void imagePrecedente() { this.index = (this.index - 1 + this.imgCarousel.length) % imgCarousel.length; } }