I need to close all the children and parent windows when I close one window in the hierarchy.
I have three lines of windows:
My windows hierarchy - All lines start in one MainWindow
. Only LoadPlayers
and CreatePlayers
are dialogs. All other windows are frames.
E.g. I close TablesOverview
in the first line - I need to close all other windows in this line.
But windows in other lines must stay open.
Notice that TablesOverview
is in two lines.
I can write the code, where I named every window that must close. But I need cleaner solution.
This code give me all opened windows - I don't know how to take only windows in one line.
Window[] windows = Window.getWindows();
This codes give me nothing.
Window[] windows = frame.getOwnedWindows();
Component comp = frame.getParent();