When the window is resized, the OS checks the limits based on its frame size. You normally calculate your limits based on your content component. Unfortunately, you have no means to find out the difference between the content size and the frame size, because getBorderThickness() returns an empty BorderSize. getBorderThickness() has to be mapped to the OS function for this to work correctly.
For windows using a native title bar you can use