Take the 2-minute tour ×

I am using the java WindowAdapter class to determine when a window is activated and then do some appropriate work. This is accomplished by implementing the windowActivated method of the WindowAdapter. Now, I am having some strange behavior and when I open one type of window it then activates another type afterwards. I tried to get a stack trace to see why the other window is being activated but the stack trace is not very helpful because all entries in the stacktrace are AWT methods until it gets to the call to the windowActivated method. Can anyone think of a good way to determine what triggered this listener?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Each of the WindowAdapter methods receives a WindowEvent. The getWindow() method should tell you which window generated the event. A short example might clarify the problem.

share|improve this answer
add comment

Your Answer


