You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "rkeen-siemens (via GitHub)" <gi...@apache.org> on 2023/05/26 14:26:48 UTC

[GitHub] [netbeans] rkeen-siemens commented on a diff in pull request #5989: #5987: Use the currently active dialog as the presenter parent

rkeen-siemens commented on code in PR #5989:
URL: https://github.com/apache/netbeans/pull/5989#discussion_r1206869897


##########
platform/openide.util.ui/src/org/openide/util/Utilities.java:
##########
@@ -1357,17 +1357,50 @@ private static Frame findMainWindow()
      */
     // PR4739
     public static Component findDialogParent() {
-        Component parent = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+        return findDialogParent(null);
+    }
+
+    /**
+     * Finds an appropriate component to use for a dialog's parent. Similar to {@link #findDialogParent()}
+     * with the ability to specify a suggested parent component.
+     *
+     * @param suggestedParent the component to return if suitable
+     * @return A suitable parent component for swing dialog displayers.
+     *
+     * @see #findMainWindow()
+     * @since 9.30
+     */
+    public static Component findDialogParent(Component suggestedParent) {

Review Comment:
   > You're suggesting adding it to the API?
   
   Yes, would be useful when using a `JOptionPane` (or similar) where you want the new dialog to be positioned relative to a specific component (`suggestedParent`) rather than just the containing window. If `NotifyDescriptor` had the option to specify a suggested parent, `DialogDisplayerImpl` would use this overload.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists