Thus, you can define paint as follows:
public void paint(Graphics g) { if (image != null) { Dimension d = getSize(); g.drawImage(image, 10, 10, d.width - 20, d.height - 20 , this); } }