rotate a Graphics Image? something like "zuma", don't remember how to do i

Hey everyone, well I want to know if anyone knows how to rotate an image? I did it last year, but I don't remember how I did it or where I found out how to do it (I lost the code in numerous reformats of my computer). But basictly if anyone has ever played the game Zuma http://www.tomdownload.com/games/puzzles/images/zuma_big3.jpg , the piece in the center rotates around in a circle to aim at the other balls, thats basictly what I want to do, so if anyone knows how to do it, can you please post some code examples! Thanks!

[535 byte] By [CrossFireXT17a] at [2007-11-27 6:04:35]
# 1

This seems to be a really common questions, you probably should have searched through previous threads before asking it. In the short time I've been here it's been asked three times. Anyway.

g.rotate(angle, x, y);

g.drawImage(image, x, y, null);

g.rotate(-angle, x, y);

That's the way I do it. Alternatively you can go

AffineTransform at = g.getTransform();

g.rotate(angle, x, y);

g.drawImage(image, x, y, null);

g.setTransform(at);

Either way, they both just rotate the Graphics context, draw the image and then set it back to it's original position. If you don't set it back after each image you draw it will draw it in wierd places and wierd angles.

Message was edited by:

RedUnderTheBed

RedUnderTheBeda at 2007-7-12 16:48:48 > top of Java-index,Security,Cryptography...