TabbedPane: fixed IndexOutOfBoundsException when using tooltip text on close buttons and closing last/rightmost tab (issue #235)

This commit is contained in:
Karl Tauber
2021-01-10 18:28:30 +01:00
parent 7d48bf06fe
commit 14222e40ad
3 changed files with 17 additions and 6 deletions

View File

@@ -2109,8 +2109,10 @@ public class FlatTabbedPaneUI
public void mouseReleased( MouseEvent e ) {
if( isPressedTabClose() ) {
updateRollover( e );
if( pressedTabIndex >= 0 && pressedTabIndex == getRolloverTab() )
if( pressedTabIndex >= 0 && pressedTabIndex == getRolloverTab() ) {
restoreTabToolTip();
closeTab( pressedTabIndex );
}
} else
mouseDelegate.mouseReleased( e );
@@ -2188,7 +2190,8 @@ public class FlatTabbedPaneUI
if( lastTipTabIndex < 0 )
return;
tabPane.setToolTipTextAt( lastTipTabIndex, lastTip );
if( lastTipTabIndex < tabPane.getTabCount() )
tabPane.setToolTipTextAt( lastTipTabIndex, lastTip );
lastTip = null;
lastTipTabIndex = -1;
}