Java Memorandom- Graphics.drawImage
投稿者:Nobu 投稿日時:2010/04/23(金) 08:58
in
In paint(Graphics g) call back, use drawImage() to draw an image. It is crucial to specify ImageObserver parameter.
I mistakenly passed a null to the parameter, and the drawing was not done properly. It renders only when any other event forces to repaint. When the parameter was properly set, the rendering happens correctly so that the image shows up from the beginning.
public class MyPanel extends Panel
{
public void paint(Graphics g)
{
if(null != image)
{
g.drawImage(image, imageX, imageY, this);
}
}
}

新しいコメントの投稿