Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top