23 lines
514 B
Java
23 lines
514 B
Java
![]() |
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;
|
||
|
}
|
||
|
}
|