The main problem is that the MouseEvents are relative to the component and so the location never changes by more than a pixel, so you keep set the window location back to where it was even as the mouse is continually moving acros the screen.
Generally, moving a component is handled by dragging the component which mean using the mouseDragged() event. A general solution can be found in
Moving Windows. This solution converts the mouse events to make the location relative to the screen.
For an older solution that doesn't convert mouse points to the screen, you need to keep track of the previous mouse event so you can determine the change in location: