开发者

Determining the source of a window activation event in Java

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 window开发者_StackOverflow中文版Activated 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜