Then, with dimensions in hand, you have paint
call the
drawImage
method, which takes arguments specifying the image,
the origin, and the dimensions. Also, because the drawImage
method
needs to know about the image-displaying properties of the component on
which the image is to be drawn, that component, the value of this
,
is supplied as the final argument:
Component --* x y *-- Width | | | | *-- Height | | | v v v v v ------------ ------------- ---- g.drawImage(image, 10, 10, d.width - 20, d.height - 20, this);
As illustrated, the image is drawn with a 10-unit border.