We are trying to save the state of the application on exit and restore it on startup. Part of the state is the relative Z-order of all JFrames.
Unfortunately, Swing doesn't seem to provide any method to learn or set Z-order of a Window (even relative to other windows in the same VM).
We deal with setting the Z-order by calling toFront() on all windows in successive order. But querying Z-order remains unsolved. (Adding focus listeners doesn't work always, for example, when one uses Windows' "Cascade" action on a group of windows.)
Any ideas?