/*
 * imageBox.java
 * English version 0.0.6
 * time 18:23
 * date 28/may/2009
 *
 * what is new?
 * *change image using imageFile properties
 * *now support design time image rendring
 *
 * Feel free to contact me for any help.
 * Ahmed AL-Yamani
 * a7med.yamani@gmail.com
/**
 *
imageBox is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any older/later version.

imageBox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with UPL.  If not, see <http://www.gnu.org/licenses/>.*/

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
public class imagebox extends JPanel {
    public void setimageFile(Icon icon) {
       imageFile=icon;
    }
    @Override
    public void paint(Graphics g) {
        super.paint(g);
        if (imageFile != null) {            
            Image imageF=  ((ImageIcon)imageFile).getImage();
           g.drawImage(imageF, 0, 0, getWidth(), getHeight(), this);
        } else {
            g.drawLine(0, 0, getWidth(), getHeight());
            g.drawLine(0, getHeight(), getWidth(), 0);
        }
    }
    private Icon imageFile = null;
}