Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hint popups don't get dismissed #91

Closed
thomaspreisler2 opened this issue Jul 10, 2023 · 0 comments
Closed

Hint popups don't get dismissed #91

thomaspreisler2 opened this issue Jul 10, 2023 · 0 comments

Comments

@thomaspreisler2
Copy link

thomaspreisler2 commented Jul 10, 2023

Using autocomplete library version 3.2.0

Sometimes the hint popup windows don't get dismissed and persist in the foreground.
Screenshot 2023-07-10 at 9 50 49 AM

How to reproduce

  1. bring up the popup hint windows
  2. click on something outside the popups that will change the component hierarchy
  3. the popups will hang around and you can't dismiss them.

Looked at the source code and I think the fix is a missing call to hideChildWindows() in the removeFrom(Window w) method in AutoCompletion.java:

/**

  • Listens for events in the parent window of the text component with

  • auto-completion enabled.
    */
    private class ParentWindowListener extends ComponentAdapter implements
    WindowFocusListener {

    public void addTo(Window w) {
    w.addComponentListener(this);
    w.addWindowFocusListener(this);
    }

    @OverRide
    public void componentHidden(ComponentEvent e) {
    hideChildWindows();
    }

    @OverRide
    public void componentMoved(ComponentEvent e) {
    hideChildWindows();
    }

    @OverRide
    public void componentResized(ComponentEvent e) {
    hideChildWindows();
    }

    public void removeFrom(Window w) {
    hideChildWindows(); <====================================. Missing!
    w.removeComponentListener(this);
    w.removeWindowFocusListener(this);
    }

    @OverRide
    public void windowGainedFocus(WindowEvent e) {
    }

    @OverRide
    public void windowLostFocus(WindowEvent e) {
    hideChildWindows();
    }
    }

Alternatively it can be fixed by adding hideChildWindows() to the hierarchyChanged(HierarchyEvent e). method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant