Window moved or resized

Hi all, How to find programatically whether the window (that is opened) is moved or resized .
[107 byte] By [Manthanaa] at [2007-11-27 7:46:58]
# 1
Use window listeners
Jamwaa at 2007-7-12 19:27:59 > top of Java-index,Java Essentials,Java Programming...
# 2
Read more at http://java.sun.com/docs/books/tutorial/uiswing/events/windowlistener.html
Jamwaa at 2007-7-12 19:27:59 > top of Java-index,Java Essentials,Java Programming...
# 3

Hi jamwa,

i saw it. There is listener for window resize, but not when the window is moved.

like when u press the title bar and move the window , how will u find out this.

resize listener works in the case of

> if u maximize or minimize

> increase or reduce the size of the window

But not in the case i have mentioned earlier.

Manthanaa at 2007-7-12 19:27:59 > top of Java-index,Java Essentials,Java Programming...
# 4
Maybe you can have a method that checks the window position every few intervals. When the position is different from what it was the last time then the window has been moved
Jamwaa at 2007-7-12 19:27:59 > top of Java-index,Java Essentials,Java Programming...
# 5
Is moving a change in state? If so you could use a WindowStateListener.
floundera at 2007-7-12 19:27:59 > top of Java-index,Java Essentials,Java Programming...
# 6

This code gives the coordinates of the top left corner your frame

JFrame fra = new JFrame("Test Page");

System.out.println("X coordinate: " + fra.getX());

System.out.println("Y coordinate: " + fra.getY());

Jamwaa at 2007-7-12 19:27:59 > top of Java-index,Java Essentials,Java Programming...
# 7
componentMoved() of ComponentListener
Michael_Dunna at 2007-7-12 19:27:59 > top of Java-index,Java Essentials,Java Programming...
# 8
I tried all combinations, but one problem or the other will still be thr. Can anyone give me a sample program which satisfy all conditionsthanx
Manthanaa at 2007-7-12 19:27:59 > top of Java-index,Java Essentials,Java Programming...
# 9

> How to find programatically whether the window (that is opened) is moved or resized .

> I tried all combinations, but one problem or the other will still be thr.

are you incapabale of looking at the api docs for ComponentListener?

I'm happy to provide sample program - please advise spoon size.

Michael_Dunna at 2007-7-12 19:27:59 > top of Java-index,Java Essentials,Java Programming...