mouse click coords and moving a rect
I was wondering what a good way to get the difference between a rectangle's x, y position and a mouse click coord. I want to have something where you can click on a rectangle and move it, but the shape position is incremented by some difference of mouse x, y and shape x,y coords. Something like this is what I mean:
double dx = (e.getX()-shape.getX());
double dy = (e.getY()-shape.getY());
the problem with this is that the shape then makes its position at the coord of the mouse click...Thanks alot!
EDIT: This effect is like when you move an application window, the position of the window is relative to some difference of the mouse pos and its own xy.