/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JImagePanel.java
 *
 * Created on 13-mar-2009, 0.50.41
 */

package com.jaspersoft.ireport.designer.welcome;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;


/**
 *
 * @author gtoffoli
 */
public class JImagePanel extends javax.swing.JPanel {

    Image image = null;
    /** Creates new form JImagePanel */
    public JImagePanel() {
        initComponents();
    }

    public void setImage(Image img)
    {
        this.image = img;
        this.repaint();
    }

    @Override
    public void paint(Graphics g) {

        if (image != null)
        {
            g.drawImage(image, 0,0,this.getWidth(), this.getHeight(), this);
        }
        else
        {
            super.paint(g);
        }
    }



    /** 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.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 300, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
