private void openPopupMenu(MouseEvent e){
  if (!e.isPopupTrigger()) {
    return;
  }
  if (popupMenu == null) {
    return;
  }
  final int index=tabs.indexAtLocation(e.getX(),e.getY());
  if (tabs.getSelectedIndex() == index) {
    popupMenu.show(tabs,e.getX(),e.getY());
  }
}

private void openPopupMenu ( MouseEvent e ) { if ( ! e . isPopupTrigger ( ) ) { return ; } if ( popupMenu == null ) { return ; } final int index = tabs . indexAtLocation ( e . getX ( ) , e . getY ( ) ) ; if ( tabs . getSelectedIndex ( ) == index ) { popupMenu . show ( tabs , e . getX ( ) , e . getY ( ) ) ; } }
open context menu manually instead of relying on the jtabbedpane , so we can check if it ' s the currently selected tab ( since the context menu will trigger actions based on the currently selected tab ) .
