Smooth window resizing.
Hello Java Forums!
Im currently experimenting with Translucent windows in Java but i'm now stuck with some silly resize logic that im trying to create.
So, the window i'm trying to resize looks like this:
Its basicly a translucent window with no rezize option from the swing library etc.
So far i have been able to resize the window using only the current mouse position (int posX, posY), but that makes the window jump to the "mousetip" everytime you try to resize the frame.
Im currently sitting with a set of variables im not sure how to put together in order to make the resizing smooth.
basicly, whats supposed to happen is that when the user initiate the mouseDragged or MouseMoved (I'm using a external library which forces me to use MouseMoved) its supposed to resize smootly independent of where the user holds his mouse on inside the window (The window should now jump back to the mouse cursor)
int posX; //Current Location of the Mouse X-AXIS
int posY; //Current Location of the Mouse Y-AXIS
int clickedMousePosX; //Location of the mouse after MOUSE CLICK X- AXIS
int clickedMousePosY; //Location of where a mouseclick happened Y-AXIS
int lastMousePosX; //Location of the mouse after MOUSE RELEASE X- AXIS
int lastMousePosY; Y-AXIS
int diffX; //Diffrence between lastMousePosX,Y and clickedMousePosX,Y
int diffY; //Diffrence between lastMousePosX,Y and clickedMousePosX,Y
If i need to explain further i will try to do so the best i can. Even if my Swenglish is horribad.
Thanks for your time!