JDK-8214252 : Expanded & Collapsed nodes of a JTree look the same on GTK3
  • Type: Bug
  • Component: client-libs
  • Affected Version: 8,11,12,13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-11-23
  • Updated: 2019-09-26
  • Resolved: 2019-01-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12 JDK 13 JDK 8 Other
11.0.4-oracleFixed 12.0.2Fixed 13 b08Fixed 8u221Fixed openjdk8u222Fixed
Test name: SwingSet2.jar  
Product(s) tested: JDK8u202 b04(64bit) , JDK12b21
OS/architecture:Oel7.5 uek x64 
VM Options:-Djdk.gtk.version=3 -Djdk.gtk.verbose=true 

1. Run the demo with the gtk version set at command line to 2 and then to 3.
2. Compare the rendering of the JTree demo when clicking to expand or collapse the tree.
Expected: Tree is shown the same with the scrollbar track being visible.
Actual: on GTK3.0 the same icon shows on expanded and collapsed tree node.

Seen on jdk8u202b04 as well as jdkb12.
Fix Request (12u) This follows the same request as already satisfied 11u and 8u. Patch applies cleanly to 12u. SwingSet2 tooltips look fine after the patch, and looks wrong before the patch. The risk is minimal.

Fix Request This issue solves GTK 3+ compatibility problem. Patch applies cleanly to 11u (and I see 11.0.4-oracle), and to 8u with reshuffling (and I see 8u221/222). SwingSet2 tooltips look fine after the patch, and looks wrong before the patch. 8u requires -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djdk.gtk.version=3 to reproduce. The risk is minimal.

This is a gtk3 issue and needs to be fixed before the switching the default. This looks like a tree state issue (expanded or collapsed). From gtk version 3.14, the state flag to represent checked or expanded state of widgets was changed from GTK_STATE_FLAG_ACTIVE to GTK_STATE_FLAG_CHECKED. Due to that, in JTree, the collapsed icon was being loaded everytime. This fix is to use correct flag to represent expanded state.

I am able to reproduce this using SwingSet2 on both jdk8_202_b04 and jdk12 on both Ubuntu and OEL7.5 with gtk3. But I also checked that the SampleTree demo works fine with gtk3 in all above scenarios. So this can be a demo issue in SwingSet2, but then it should be present in both gtk2 and gtk3. I need to do some further investigation to root cause this. As of now, I am accepting this bug as I can reproduce the issue as described by the submitter.