private void checkForPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
                int tabNumber = pane.getUI().tabForCoordinate(pane, e.getX(), e.getY());
                if (tabNumber >= 0) {//must be a tab
                    Component c = e.getComponent();
                    menu.setCurrentTab(tabNumber);//set the selected tab
                    menu.show(c, e.getX(), e.getY());
                }
            }
        }