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

Tool bar buttons with tab style leave traces on High DPI #582

Open
Chrriis opened this issue Aug 23, 2022 · 4 comments
Open

Tool bar buttons with tab style leave traces on High DPI #582

Chrriis opened this issue Aug 23, 2022 · 4 comments

Comments

@Chrriis
Copy link
Contributor

Chrriis commented Aug 23, 2022

Hi,

While making sure our application works properly on Windows with 125% scale factor, I found a new bug related to tool bar buttons with tab style.

Here is a screenshot:
ToolBarButtonsHighDpi

Button2 is selected and Button1 is hovered. Button5 and Button3 left some traces from previous selections, which is not correct.
Note that when the tooltip disappears, some repainting occurs that might clear some of the traces. I got the gray trace after showing the tooltip and changing selections.

Here is the test case:
ToolBarButtonTestOnHighDpi.zip
The button at the bottom allows to increase the top gap, because this problem only happens for certain "y" locations.

It took me hours to isolate that one in a standalone test case! Do not hesitate if you need more information 😉

@DevCharly
Copy link
Collaborator

Many thanks for the test case 👍

Looks like a rounding issue in Swing, caused by painting only a small region when e.g. painting button hover.

There are two cases:

  1. painting whole window: the full height of the button is filled
  2. re-painting only the button: not the full height of the button is filled

image

In both cases, the same simple fill operation is used: g.fillRect( 0, 0, c.getWidth(), c.getHeight() );

Don't yet know what makes the difference... 😕

@Chrriis
Copy link
Contributor Author

Chrriis commented Aug 24, 2022

Thanks for the investigation.

Here is a simplified test case showing the issue with Graphics2D:
Graphics2DTestOnHighDpi.zip

There are two labels at the bottom: the "Repaint all" label paints one more pixel than the "Repaint component" label.
This is due to its affine transform (with 1.25 factor) and its translateY that is different, probably mapping the end pixel with one off.

Now, I am not sure what we can do about it, but the UI is corrupted because of such issue... 😕

@Chrriis
Copy link
Contributor Author

Chrriis commented Aug 24, 2022

@Chrriis
Copy link
Contributor Author

Chrriis commented Aug 26, 2022

And the bug I opened: https://bugs.openjdk.org/browse/JDK-8292976

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

2 participants