1

I am writing Java code to rotate images on a fixed background image, like rotating a needle image on clock background.

There are multiple needle in the watch, one needle for hours and another one for minutes.

How to rotate 2d graphics images on fixed background?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
rkkamlesh007
  • 23
  • 1
  • 6

1 Answers1

2
  • Start with a base, static image (ie a clock face), where the parts you need to animate have being cut out.
  • On top of this you can render each element you need at the required locations.

Start by having a look at...

You'll need some way to update the movement. This can be achieved through the use of a single or multiple javax.swing.Timer timers, see Concurrency in Swing for details.

The rotation is a little more fun, but can be achieved through the use of an AffineTransform

Take a look at...

Community
  • 1
  • 1
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366