I got an extended JLabel
class where I draw my Map using the code below :
the new AffineTransform()
is the identity to left my image as it is (0,0,w,h)
I found these:
Don't know if they will help or not.
Its not so hard ;-)
When you repaint the Component save the AffineTransform
after the transforming with g2.getTransform()
Then call the function invert()
on it
In the mouseClicked()
event us the following code:
Point2D p= trans.transform(new Point2D.Double(evt.getX(), evt.getY()), null);
System.out.println("click x="+p.getX()+" y="+p.getY());
Thats it!
It sounds like you need both a forward and inverse transform to translate between the two co-ordinate systems. In this example, the scaling equations are explicit; in this alternate approach, a second AffineTransform
is used.