How to properly focus a JBPopup?

I have the following code that does a rather weird thing:

        JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, panel)
                .setRequestFocus(true)
                .setCancelOnClickOutside(true)
                .setCancelOnOtherWindowOpen(false)
                .setMovable(true)
                .setTitle("Comment")
                .setResizable(true)
                .setCancelKeyEnabled(true)
                .createPopup();
        popup.showInBestPositionFor(anActionEvent.getDataContext());


"panel" contains the content of my popup. The contents include (among other things) a bunch of HyperlinkLabels, which, when hoovered over, should turn the cursor pointer into a "hand". Unfortunately, when the popup first appears, the cursor pointer does not change into a hand. Instead, it remains a "caret", as if the focus was still in the editor window, which is the parent of the popup. I have to manually click inside the popup to get it to become the focus owner and from then on, the cursor behaves as it should.

What am I doing wrong?

Cheers
Janusz

Please sign in to leave a comment.