views:

27

answers:

1

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?

+1  A: 

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.

trashgod