JDK-8023474 : First mousepress doesn't start editing in JTree
  • Type: Bug
  • Status: Closed
  • Resolution: Fixed
  • Component: client-libs
  • Sub-Component: java.awt
  • Priority: P3
  • Affected Version: 7,8
  • Submit Date: 2013-08-21
  • Updated Date: 2014-02-12
  • Resolved Date: 2013-08-26
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u60Fixed 8 b110Fixed
Related Reports
Duplicate :  
Description
Run the attached testcase with JDK 7 or JDK 8 and click on the check box on any tree node. The check box doesn't get selected or unselected. Now click again (second time) and you will see that check box editor is getting selected/unselected properly.
Comments
Verified by attached test CheckBoxTreeDemo java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b112) Java HotSpot(TM) Client VM (build 25.0-b54, mixed mode) Linux virt 3.8.0-29-generic #42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 2013 i686 i686 i386 GNU/Linux
2013-10-30

Problem description: According to the current implementation of BasicTreeUI.startEdititng() we revalidate the editingComponent (so that it (along with its children) gets correct size and gets painted properly). And then we find the deepest component inside the editingComponent to dispatch the initial mouse event. But the issue here is since we call revalidate on editingComponent (if its a JComponent), the child components of editingComponent doest have proper bounds yet. The invocation of revalidate() will do it only asynchronously and the right sizes are not returned immediately. So SwingUtilities.getDeepestComponentAt() doesn't return the right child component within the editingComponent by this time. Suggested fix: We should find the first valid root for the editingComponent and call Container.validateUnconditionally() for it instead of revalidate() invocation.
2013-08-22