This week's book giveaway is in the Servlets forum. We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line! See this thread for details.

Okay so I have a set of rectangles that I need to be able to move.

Basically at this point once it gets the x,y values that are inside the rectangle it will move the coordinates of the Rectangle's x,y to where I'm moving it, so my mouse position is always 0,0. What I want is to be able to have the rectangle move based on it's exact position clicked i.e, if I click 20,20 inside the rectangle I want to always be at 20,20.

So what exactly I'm looking for is if there is a method or something that I know where exactly inside the rectangle I am and the distance from that point to the outside to recreate my rectangle. so if I am at 20,20 in a 100,100 rectangle, then I should know I'm 20 from the xtop, ytop and 80 from xbot,ybot.