Events for dragging a window in Java

I am trying to implement the OS X mailbox highlighting function in Java, and therefore I will have one window hiding under another. However, when I drag the main window (JFrame), I need to send updates when it moves to the secondary window (JWindow) below.

So, it will be something like this ...

---------------
|             |----------
|   JFrame    |          |
|             |  JWidow  |
|             |          |
|             |          |
|             |          |
|             |-----------
---------------

However, the ComponentListener in OS X does not send constant updates to componentMoved only when you pause for a second or remove the mouse. This seems to be different from Win / Linux, so I was wondering if anyone else had a solution.

Without a complete understanding of everything, I was hoping to get and figure out what draws the window title (something like a root panel). I'm not even sure if this will be possible, but this is the only other solution I can come up with to determine when the whole window is being dragged.

Any help is appreciated!

+5
source share
2 answers

Assuming you have a trusted code, you can use MouseInfo.getPointerInfo()to get the location of the pointer. This information can be tested so that you can work where the window should be. You can just ask where the window is anyway.

+1
source

mouseMotionListener, , , , getLocation(). , , . , getLocation() , , .

+1

All Articles