correction ayoub et controleur conv
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package fr.iutfbleau.sae.vconverter;
|
||||
|
||||
import javax.swing.*;
|
||||
import fr.iutfbleau.sae.util.Config;
|
||||
import java.awt.*;
|
||||
import java.util.Map;
|
||||
|
||||
import fr.iutfbleau.sae.util.Config;
|
||||
import javax.swing.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
/**
|
||||
* Fenêtre principale du convertisseur.
|
||||
@@ -101,7 +101,7 @@ public class ConverterWindow extends JFrame {
|
||||
*
|
||||
* @param img image à afficher
|
||||
*/
|
||||
public void setImagePreview(Object img) {
|
||||
public void setImagePreview(BufferedImage img) {
|
||||
imagePreviewPanel.setImage(img);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package fr.iutfbleau.sae.vconverter;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
* Le panneau d’aperçu de l’image.
|
||||
@@ -12,11 +13,27 @@ package fr.iutfbleau.sae.vconverter;
|
||||
|
||||
|
||||
public class ImagePreviewPanel extends JPanel {
|
||||
|
||||
private BufferedImage image;
|
||||
|
||||
public ImagePreviewPanel() {
|
||||
// constructeur vide pour l'instant
|
||||
}
|
||||
|
||||
public void setImage(Object img) {
|
||||
// Implémentation à ajouter
|
||||
public void setImage(BufferedImage img) {
|
||||
this.image = img;
|
||||
repaint();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(java.awt.Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (image != null) {
|
||||
// Dessiner l'image centrée dans le panneau
|
||||
int x = (getWidth() - image.getWidth()) / 2;
|
||||
int y = (getHeight() - image.getHeight()) / 2;
|
||||
g.drawImage(image, x, y, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user