import java.awt.Component; import java.awt.Graphics; import java.awt.Image; /** * A lightweight component which simply renders an image */ public class ImageLabel extends Component { /** * the image to be rendered */ Image image = null; /** * set the image for this component */ public void setImage(String imageFilename) throws InterruptedException { image = Utils.getImage(imageFilename); } /** * draw the image onto the Graphics context */ public void paint(Graphics g) { if (image != null) g.drawImage(image,getLocation().x,getLocation().y,getSize().width,getSize().height,null); } }