Getting a JFrame's actual current location
- by Ian Fellows
Hello community,
I am trying to create a (child) JFrame which slides out from underneath one side of a second (parent) JFrame. The goal is to then have the child follow the parent around when it is moved, and respond to resizing events. This is somewhat related to this question.
I have tried using a ComponentListener, but with this method the child only moves once the parent has come to a stop, whereas I would like the child to move as the parent is dragged around the screen.
Another option I attempted was to start a new refresher thread that continually updated the child's location using getLocation() or getLocationOnScreen(), but the lag was the same as with ComponentListener.
Is there a way to get the true actual location of a JFrame even in the midst of a drag? or if not, is there a way to get the effect of a sheet sliding out from underneath and following the Frame around?