This commit is contained in:
Denis Fokin
2016-09-30 10:40:52 +03:00
parent 0881cae40e
commit d4f69f6a99
@@ -33,6 +33,9 @@ public class OwnerOptional {
@NotNull
private static Window findOwnerByComponent(Component component) {
if (component == null) component = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
if (component == null) {
component = Window.getWindows()[0];
}
return (component instanceof Window) ? (Window) component : SwingUtilities.getWindowAncestor(component);
}