/*
 * ImagePanel.java
 *
 * Created on 9 de Janeiro de 2008, 19:00
 */
package br.gfca.openstereogram.gui;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

/**
 *
 * @author  Gustavo
 */
public class ImagePanel extends javax.swing.JPanel {

    /**
     * 
     */
    private static final long serialVersionUID = -2756196238320814039L;
    private Image image;

    /** Creates new form BeanForm */
    public ImagePanel() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Código Gerado ">//GEN-BEGIN:initComponents
    private void initComponents() {

        setBackground(new java.awt.Color(255, 255, 255));
    }// </editor-fold>//GEN-END:initComponents

    public void setImage(Image i) {
        this.image = i;
        this.setPreferredSize(new Dimension(i.getWidth(null), i.getHeight(null)));
        this.repaint();
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        g.drawImage(this.image, 0, 0, null);
    }
    
    // Declaração de variáveis - não modifique//GEN-BEGIN:variables
    // Fim da declaração de variáveis//GEN-END:variables
}
