Skip to content

Conversation

@mbien
Copy link
Member

@mbien mbien commented Nov 21, 2025

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)

other:

  • removed obsolete code in ToolTipAnnotation and minor cleanup in that class (no other changes).

debug graphics indicates the ignore area, before:
debug-tooltip-before

after:
debug-tooltip-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,baz next 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)

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).
@mbien mbien added this to the NB29 milestone Nov 21, 2025
@mbien mbien added Editor UI User Interface ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) debugger labels Nov 21, 2025
@mbien
Copy link
Member Author

mbien commented Nov 21, 2025

flatlaf does do something similar btw but for context sub-menus: JFormDesigner/FlatLaf#490

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) debugger Editor UI User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant