visualvm icon indicating copy to clipboard operation
visualvm copied to clipboard

Default text selection makes the underlying text unreadable

Open Akirathan opened this issue 3 years ago • 5 comments

Describe the bug The default selection of a text in any tab (I tried "heap dump" and "threads") is black, which makes the underlying text unreadable.

To Reproduce Steps to reproduce the behavior:

  1. Execute jvisualvm without any arguments.
  2. Click on any application from the selection.
  3. Go to, e.g., "threads" tab and click on any thread.

Expected behavior On my system, the selection in the applications panel have gray background, which is fine. I would expect that the selection in "threads" or "heap dump" tabs have gray background as well.

VisualVM log messages.log

Screenshots visual_vm_black_selection_objects

Desktop:

  • OS: Ubuntu 21.10
  • JDK version: OpenJDK 64-Bit Server VM 11.0.13+7-jvmci-21.3-b05
  • VisualVM Version: 2.1.1
  • GraalVM Version: 21.3.0
  • Desktop: Gnome 40, with default default theme (Yaru)

Workaround The workaround for me is to execute the VisualVM with:

./visualvm --laf Metal --fontsize 13

Akirathan avatar Jan 17 '22 11:01 Akirathan

Thank you for the bugreport! I'm unable to reproduce the problem using my Ubuntu 20.04/Yaru, will try 21.10 according to your setup. Do you use any UI theme customizations?

Can you please provide a screenshot of bin/jconsole with some selection? This should help us to understand whether this is a generic Swing issue or a VisualVM-side problem.

What is the selection color in VisualVM text components? Please switch to the Overview tab and select the text there. Is the selection rendered correctly using the gray color?

Seeing some GTK rendering issues on your screenshot, could you please try to run VisualVM using visualvm -J-Djdk.gtk.version=2 to see whether it makes any difference?

jisedlac avatar Jan 17 '22 11:01 jisedlac

It would be also useful to try running VisualVM on newer JDK. Can you try JDK 18? jvisualvm --jdkhome <path_to_jdk>

thurka avatar Jan 17 '22 11:01 thurka

Thank you for the bugreport! I'm unable to reproduce the problem using my Ubuntu 20.04/Yaru, will try 21.10 according to your setup. Do you use any UI theme customizations?

I don't use any UI theme customizations, I have left everything theme-related to the defaults. Aside from that, I have some other gnome shell extensions that are, I believe, unrelated to the theming.

Can you please provide a screenshot of bin/jconsole with some selection? This should help us to understand whether this is a generic Swing issue or a VisualVM-side problem.

Here it is jconsole_black_selection . The selection has a black background, which is exactly the same background as in bin/jvisualvm, which makes the text unreadable.

What is the selection color in VisualVM text components? Please switch to the Overview tab and select the text there. Is the selection rendered correctly using the gray color?

Here is a screenshot visualvm_text_selection_orange . It is rendered with orange color. I believe this is the default text selection background color for any GTK application on my system. I tried to select some text in gitg, which is a GTK application, and the background is also orange.

Seeing some GTK rendering issues on your screenshot, could you please try to run VisualVM using visualvm -J-Djdk.gtk.version=2 to see whether it makes any difference?

Yes, it makes a huge difference. It seems that all the selections, including text selections, and element selections in "threads" tab, have orange background. Screenshot is here jvisualvm_gtk2_selection . With GTK2 configuration, everything seems fine and neat.

Akirathan avatar Jan 17 '22 12:01 Akirathan

It would be also useful to try running VisualVM on newer JDK. Can you try JDK 18? jvisualvm --jdkhome <path_to_jdk>

With JDK 17:

openjdk 17 2021-09-14
OpenJDK Runtime Environment (build 17+35-jvmci-21.3-b03)
OpenJDK 64-Bit Server VM (build 17+35-jvmci-21.3-b03, mixed mode, sharing)

I experience the exact same behavior as with JDK11, that is:

  • Element selection in the overview pane has gray background
  • Text selection anywhere has orange background
  • Element selection in thread panel has black background

Akirathan avatar Jan 17 '22 12:01 Akirathan

Thanks for the details! From the JConsole screenshot it's clear that this is a general Swing issue. The right solution seems to be forcing the rendering pipeline to use GTK 2. Let's keep this bugreport open for further investigation.

jisedlac avatar Jan 17 '22 12:01 jisedlac

Not to be addressed on the VisualVM side - a generic Swing issue with a known solution.

jisedlac avatar Apr 19 '24 13:04 jisedlac