Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting tab click with mousePressed instead of mouseClicked. #2097

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

AndreiKud
Copy link
Contributor

@AndreiKud AndreiKud commented Feb 4, 2024

Hello! Changed MouseAdapter callback from mouseClicked to mousePressed. Reasons:

  1. MouseEvent.MOUSE_CLICKED is only sent when there is no movement between press and release events, not even a single pixel. Maybe my mouse is too sensitive, but it is challenging to close or select a tab without significally slowing down the mouse or fully stopping it.
  2. BasicTabbedPaneUI.java itself handles tab selecting within mousePressed (line 2611). As a result, the behavior differs when clicking at the tab's center compared (our handler) to clicking at its edges (parent's handler).

@skylot
Copy link
Owner

skylot commented Feb 4, 2024

@AndreiKud thanks 👍

@skylot skylot merged commit 7e628ad into skylot:master Feb 4, 2024
5 checks passed
@AndreiKud AndreiKud deleted the tab_component_press_handling branch February 4, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants