if (tabPane.isEnabled())
Object s = e.getSource();     if (tabPane != e.getSource()) { redispatchEvent(e); e.setSource(s); }  int placement = tabPane.getTabPlacement();  if (s == incrButton) { if(!incrButton.isEnabled()) return;  currentScrollLocation++;  switch (placement) { case JTabbedPane.TOP: case JTabbedPane.BOTTOM: currentScrollOffset = getTabAreaInsets(placement).left; for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].width; break; default: currentScrollOffset = getTabAreaInsets(placement).top; for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].height; break; }  updateViewPosition(); updateButtons();  tabPane.repaint(); } else if (s == decrButton) { if(!decrButton.isEnabled()) return;     if (currentScrollLocation > 0) currentScrollLocation--;   currentScrollOffset = 0;  switch (placement) { case JTabbedPane.TOP: case JTabbedPane.BOTTOM:  if (currentScrollLocation > 0) currentScrollOffset = getTabAreaInsets(placement).left;  for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].width; break; default:  if (currentScrollLocation > 0) currentScrollOffset = getTabAreaInsets(placement).top;  for (int i = 0; i < currentScrollLocation; i++) currentScrollOffset += rects[i].height; }  updateViewPosition(); updateButtons();  tabPane.repaint(); } else if (tabPane.isEnabled())
    public void mousePressed(MouseEvent e)    {      if (tabPane.isEnabled())        {          int index = tabForCoordinate(tabPane, e.getX(), e.getY());          if (index >= 0 && tabPane.isEnabledAt(index))            {              tabPane.setSelectedIndex(index);            }            }        }