I googled this problem a lot but can't find any answers. I have legacy system with three JFrame objects. They were created in one chain: first JFrame is parent for second one, second is parent for third.
The problem is after I close third window, the first window receive focus and the second one is going behind the first. And its wrong. I expect that after closing third JFrame focus will go to the second window. What could be the problem and how to fix this wrong behaviour?
Code looks something like this:
Frame first = new JFrame(null, "first");
JDialog second = new JDialog(first, "second");
JFrame third = new JFrame(second, "third");
third.addWindowListener(new WindowAdapter() {
// request focus in second window when focus lost in third
});