The constructor
getPreferredSize Dimension d = null; if(canvas_image == null) { d = new Dimension(200, 200); } else d = new Dimension(canvas_image.getWidth(this), canvas_image.getHeight(this)); return d;
Dimension d = null; if(canvas_image == null) { d = new Dimension(200, 200); } else d = new Dimension(canvas_image.getWidth(this), canvas_image.getHeight(this)); return d;
paint method if(canvas_image != null) g.drawImage(canvas_image, 0, 0, this);
if(canvas_image != null) g.drawImage(canvas_image, 0, 0, this);
set the image canvas_image = new_image; this.invalidate(); this.repaint();
canvas_image = new_image; this.invalidate(); this.repaint();