Getting a JFrame's actual current location

Posted by Ian Fellows on Stack Overflow See other posts from Stack Overflow or by Ian Fellows
Published on 2010-06-14T05:08:23Z Indexed on 2010/06/14 5:12 UTC
Read the original article Hit count: 222

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about gui