Switch and close tabs on left mouse click only

This commit is contained in:
ShadelessFox
2022-09-25 21:52:44 +03:00
parent 614ac956de
commit 95522846ac

View File

@@ -2589,7 +2589,7 @@ public class FlatTabbedPaneUI
public void mousePressed( MouseEvent e ) { public void mousePressed( MouseEvent e ) {
updateRollover( e ); updateRollover( e );
if( !isPressedTabClose() ) if( !isPressedTabClose() && SwingUtilities.isLeftMouseButton(e) )
mouseDelegate.mousePressed( e ); mouseDelegate.mousePressed( e );
} }
@@ -2644,7 +2644,7 @@ public class FlatTabbedPaneUI
// check whether mouse hit tab close area // check whether mouse hit tab close area
boolean hitClose = isTabClosable( tabIndex ) && getTabCloseHitArea( tabIndex ).contains( x, y ); boolean hitClose = isTabClosable( tabIndex ) && getTabCloseHitArea( tabIndex ).contains( x, y );
if( e.getID() == MouseEvent.MOUSE_PRESSED ) if( e.getID() == MouseEvent.MOUSE_PRESSED && SwingUtilities.isLeftMouseButton(e) )
pressedTabIndex = hitClose ? tabIndex : -1; pressedTabIndex = hitClose ? tabIndex : -1;
setRolloverTabClose( hitClose ); setRolloverTabClose( hitClose );
setPressedTabClose( hitClose && tabIndex == pressedTabIndex ); setPressedTabClose( hitClose && tabIndex == pressedTabIndex );