version copilot
This commit is contained in:
23
DEV.3.1/TP/TP2/Galerie.1/GModel.java
Normal file
23
DEV.3.1/TP/TP2/Galerie.1/GModel.java
Normal file
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user