United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8023474 : First mousepress doesn't start editing in JTree

Details
Type:
Bug
Submit Date:
2013-08-21
Status:
Closed
Updated Date:
2014-01-14
Project Name:
JDK
Resolved Date:
2013-08-26
Component:
client-libs
OS:
Sub-Component:
java.awt
CPU:
Priority:
P3
Resolution:
Fixed
Affected Versions:
7,8
Fixed Versions:

Related Reports
Backport:
Duplicate:

Sub Tasks

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
URL:   http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/22ef5187a3e6
User:  lana
Date:  2013-10-01 17:37:37 +0000

                                     
2013-10-01
URL:   http://hg.openjdk.java.net/jdk8/awt/jdk/rev/22ef5187a3e6
User:  alitvinov
Date:  2013-08-26 13:42:25 +0000

                                     
2013-08-26
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



Hardware and Software, Engineered to Work Together