boolean () { Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); return activeWindow instanceof JDialog && ((JDialog)activeWindow).isModal() && (dialog == null || dialog.getWindow() != activeWindow); }