boolean (Component source) { Window dialogWindow = SwingUtilities.windowForComponent(getDialog().getPanel()); return dialogWindow instanceof JDialog && SwingUtilities.isDescendingFrom(source, dialogWindow); }