Hello, I am new to java, and I need help with images. I am trying to move an image up the screen while still allowing another image to move using the arrow keys. If I use `thread.sleep` to move the image, I cant move my other image at the same time. Does anybody have a solution? I am on Mac OSX Lion, if that helps. My code is attached.
Jump to Post
Have you looked at using a Timer? The listener method can change the image's x,y location and call repaint() which will cause the paintComponent() method to be called where the drawImage() method can draw the image at the new x,y location.
All 5 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.