version copilot
This commit is contained in:
@@ -2,32 +2,25 @@ import java.awt.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class GFenetre extends JFrame {
|
||||
|
||||
private JFrame frame;
|
||||
private JLabel image1;
|
||||
private JLabel image2;
|
||||
private GestionSouris gsouris;
|
||||
private JLabel imgJLabel;
|
||||
|
||||
public GFenetre() {
|
||||
this.frame = new JFrame("Galerie");
|
||||
this.image1 = new JLabel(new ImageIcon("image1.jpeg")); //que gif, png et jpeg
|
||||
this.image2 = new JLabel(new ImageIcon("MICHEL.gif"));
|
||||
this.gsouris = new GestionSouris(this.image2, this);
|
||||
super("Galerie");
|
||||
this.setSize(1000, 600);
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
this.frame.setSize(1000, 600);
|
||||
this.frame.setLocation(100,100);
|
||||
this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
this.image2.setHorizontalAlignment(JLabel.CENTER);
|
||||
this.frame.add(this.image2, BorderLayout.CENTER);
|
||||
|
||||
this.image2.addMouseListener(this.gsouris);
|
||||
this.image1.addMouseListener(this.gsouris);
|
||||
this.imgJLabel = new JLabel();
|
||||
this.add(this.imgJLabel, BorderLayout.CENTER);
|
||||
|
||||
|
||||
|
||||
this.frame.setVisible(true);
|
||||
}
|
||||
|
||||
public void afficherImage(ImageIcon image) {
|
||||
this.imgJLabel.setIcon(image);
|
||||
}
|
||||
|
||||
public JLabel getImageLabel() {
|
||||
return this.imgJLabel;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user