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

ToolTip is refreshing multiple times when cursor is moving #832

Closed
yashwanththati5 opened this issue Apr 5, 2024 · 5 comments
Closed

ToolTip is refreshing multiple times when cursor is moving #832

yashwanththati5 opened this issue Apr 5, 2024 · 5 comments
Milestone

Comments

@yashwanththati5
Copy link

Attaching a video for better understanding

tooltipIssue.mp4

Can we get any suggestions on how to fix this tooltip rendering issue in flatlaf , Thanks in advance.

@DevCharly
Copy link
Collaborator

Not sure what you're doing.
By default, a tooltip does not follow the mouse location (as in the video).
So you probably have some code that moves the tooltip, or re-creates tooltip at new location.

Please provide a self-contained test app that demonstrates the problem.

Also try disabling rounded border. Then maybe light-weight tooltips are used (when the tooltip fits into the frame).

UIManager.put( "ToolTip.borderCornerRadius", 0 );

@DevCharly
Copy link
Collaborator

@mellmann has posted a test case to reproduce the issue here: #672 (comment)

This is actually a general Swing problem and occurs as soon as "heavy weight" popups (based on JWindow) are used, which is always the case for FlatLaf to get nice borders with drop shadows from the operating system. Other Lafs use "light weight" popups (based on JPanel) when the tooltip fits into the containing window, but switch to "heavy weight" popups as soon as the tooltip is displayed (partly) outside of the window.

@mellmann you should see the same flickering tooltip in other Lafs when you move the mouse near the bottom or right window edge so that the tooltip is displayed outside of the test window.

Moving a popup/tooltip is only possible by hiding the old popup and showing a new popup at a new location (see javadoc of javax.swing.Popup).

Because "heavy weight" popups use a JWindow (a operating system window), which is continuously hidden and re-shown while the tooltip is moved, it flickers.

This is not easy to fix, but I have an idea how it could work... 😄

@DevCharly
Copy link
Collaborator

Fixed in latest 3.5-SNAPSHOT: https://github.com/JFormDesigner/FlatLaf#snapshots

@DevCharly DevCharly added this to the 3.5 milestone May 22, 2024
@mellmann
Copy link

@DevCharly thanks for the quick reaction! I'm looking forward to trying out the fix in the next few days.

I'm not sure if it's helpful but, I noticed that the delays only appear with the native libraries. If the native library is deactivated then everything is fast (of course, some modern decorations like the round corners disappear as well).

System.setProperty( "flatlaf.useNativeLibrary", "false" );

@DevCharly
Copy link
Collaborator

I'm not sure if it's helpful but, I noticed that the delays only appear with the native libraries. If the native library is deactivated then everything is fast (of course, some modern decorations like the round corners disappear as well).

Yes, but only on Windows and only as long as the tooltip fits into the containing windows.
On macOS and Linux, FlatLaf always uses "heavy weight" popups.

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

No branches or pull requests

3 participants