Skip to content

Hint popups don't get dismissed #91

Description

@thomaspreisler2

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions