Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8429531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:21:53+00:00 2026-06-10T05:21:53+00:00

I have a popup with settings displayed to the user. If you click outside

  • 0

I have a popup with settings displayed to the user. If you click outside it, its hidden but if you click inside it remains visible.

The event handler handling this behavior gets the Component (that was clicked) and by using component.getParent() recursively I can check if its a child of my settings panel. This has worked so far.

But I just added a JComboBox to that panel and it turns out that the “selectable items popup” (does it have a name?) the combobox shows when clicked isnt a child of the combobox. Attempting to select something in a combobox would hide my settings panel.

Using the NetBeans debugger I can see its of the type BasicComboPopup$1 (is that an anonymous class?), but it isn’t an instance of neither ComboPopup, JPopupMenu nor BasicComboPopup.

I need a way to identify the owner/parent combobox of the “combobox popup” that was clicked.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:21:55+00:00Added an answer on June 10, 2026 at 5:21 am

    not entirely sure, but you might be looking for

     popup.getInvoker();
    

    which would return the invoking comboBox.

    Below’s utility method (copied from SwingXUtilities, which comes with the SwingX framework): given you found the source component (unfortunate naming in the method is focusOwner 😉 of an event, it checks whether that source is somehwhere below the parent, including popups.

    Just noticed that your parent is-a popup, so you have to adjust the logic a bit, switching the first and second if block (didn’t try, though – it’s unusual to have more than one visible popups. 🙂

    /**
     * Returns whether the component is part of the parent's
     * container hierarchy. If a parent in the chain is of type 
     * JPopupMenu, the parent chain of its invoker is walked.
     * 
     * @param focusOwner
     * @param parent
     * @return true if the component is contained under the parent's 
     *    hierarchy, coping with JPopupMenus.
     */
    public static boolean isDescendingFrom(Component focusOwner, Component parent) {
        while (focusOwner !=  null) {
            if (focusOwner instanceof JPopupMenu) {
                focusOwner = ((JPopupMenu) focusOwner).getInvoker();
                if (focusOwner == null) {
                    return false;
                }
            }
            if (focusOwner == parent) {
                return true;
            }
            focusOwner = focusOwner.getParent();
        }
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have popup-window in my script. I use window.open, but almost all browsers block
I have a popup search box that is shown when the user mouses over
I'm developing for Windows 8 (WInRT) and have problem with settings charm. Settings popup
I have a popup that stores a DataTable into a session so that after
I have a popup window (selectReasonCode) that is opened up from a button. The
I have a popup menu that has a few items in it. Option 1
I have a Popup defined like this: <Popup Name=myPopup StaysOpen=True Placement=Bottom PlacementRectangle=0,20,0,20 PlacementTarget={Binding ElementName=myPopupAnchor}>
I have a popup function in a program that works well, be re-loads the
I have a popup select box in a form in my jQuery Mobile application.
I have 1st popup, and this 1st popup opens 2nd popup Code: <view-state id=paneMaintenance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.