This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In the button's actionPerformed, it's pointless to test whether the popup menu is visible, as the action of clicking the button hides the popup. This happens before the button is released and the actionListener code executes.
You might like to disable the button and re-enable it when the popup is hidden.
Edit: No, that's not a solution. The button becomes enabled because a moue down over the disabled button hides the popup.
Edit2: Queuing the enabling of the button solves the problem. Code updated.