I figured out the answer. I override processMouseEvent to know when the menu was clicked, and than simply set the location of the popup menu relative to the location of the menu.
@Override
protected void processMouseEvent(MouseEvent e) {
super.processMouseEvent(e);
if(e.getID() == MouseEvent.MOUSE_PRESSED)
getPopupMenu().setLocation(
getLocationOnScreen().x+getWidth()/2-getPopupMenu().getWidth()/2,
getLocationOnScreen().y+getHeight());
}