Improve editor tooltip mouse ignore area computation.#9028
Merged
mbien merged 1 commit intoapache:masterfrom Nov 24, 2025
Merged
Improve editor tooltip mouse ignore area computation.#9028mbien merged 1 commit intoapache:masterfrom
mbien merged 1 commit intoapache:masterfrom
Conversation
Some editor tooltips are interactive. To be able to enter the tooltip with the mouse, a rectangle is computed which prevents the tooltip to hide, even if the mouse leaves the component (which would hide it instantly). This improves this mechanism slightly by - adding an extra x-margin to the ignored area - offsetting the debugger tooltip to further move the buttons into the ignored area (right above the mouse cursor) removed obsolete code in ToolTipAnnotation and minor cleanup in that class (no other changes).
Member
Author
|
flatlaf does do something similar btw but for context sub-menus: JFormDesigner/FlatLaf#490 |
matthiasblaesing
approved these changes
Nov 23, 2025
Contributor
matthiasblaesing
left a comment
There was a problem hiding this comment.
Approach looks minimally invasive and sane to me. I tested a minimal sample and the usage "felt" good. I.e. moving from hovered value to tooltip felt natural, while retaining the ability to move to other variables.
Thank you.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some editor tooltips are interactive. To be able to enter the tooltip with the mouse, a rectangle is computed which prevents the tooltip to hide, even if the mouse leaves the component (which would hide it instantly).
This improves this mechanism slightly by
other:
ToolTipAnnotationand minor cleanup in that class (no other changes).debug graphics indicates the ignore area, before:

after:

please note the area is now wider and the tooltip moved even more to the left, I was just too lazy to re-create the screenshot.
also: the code path is shared with some other editor tooltips, e.g ctrl+hover javadoc tooltip
other things I tried:
Why can't it be the entire width of the tooltip? Because this would prevent neighboring components to spawn their own tooltip (see example with
foo,bar,baznext to each other). I did try to fight this problem by making the ignore area time based - but this made the code even more complicated and harder to maintain.things I didn't try but could further improve this mechanism:
Use a trapezoid instead of a rectangle (upper part could have the width of the tooltip)
closes #8961 (alternative proposal)