/* * ImagePanel.java * * Created on March 31, 2006, 6:59 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package my.upper;import java.awt.Graphics;import java.awt.Image;import java.io.Serializable;import javax.swing.JPanel;/** * * @author dud */public class ImagePanel extends JPanel implements Serializable { Image image = null; public ImagePanel() { } public ImagePanel(Image image) { this.image = image; } public void setImage(Image image){ this.image = image; } public Image getImage(Image image){ return image; } public void paintComponent(Graphics g) { super.paintComponent(g); //paint background if (image != null) { //there is a picture: draw it int height = this.getSize().height; int width = this.getSize().width; g.drawImage(image,0,0, width, height, this); } }}