MouseListener () { return new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { isOverPopup = true; } @Override public void mouseExited(MouseEvent e) { if (link == null || !link.getBounds().contains(e.getPoint())) { isOverPopup = false; hidePopup(false); } } }; }