简体   繁体   中英

Trailing Image in Graphics.drawImage() method

I have an image that I need to move by calling:

int Y = 100;
Graphics g = Canvas().getGraphics(); //Canvas is a Java 3D Canvas 3D
g.drawImage(Image, 400, Y, Canvas);

I also have a keylistener that moves the image, but whenever the image moves it leaves behind a trail of images. Is there any way to fix this?

You're missing much important information from your question forcing us to guess, and this is not a good thing. My guess: If you are drawing this in a paint(...) or paintComponent(...) method, then you must first call the super method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM