PING: JDK-8146900: [SwingNode, DND]: drag-and-drop from JTable not working, drag recognized twice

Kevin Rushforth kevin.rushforth at oracle.com
Fri Jun 17 15:09:10 UTC 2016


I missed seeing this when you first posted it. I will add your comments 
to the bug report. Alexander Z may want to chime in since the bug is 
assigned to him and he is the component lead for SwingNode.

-- Kevin


Yasumasa Suenaga wrote:
> PING: Have you ever read this proposal?
>
> Yasumasa
>
> On 2016/06/08 22:05, Yasumasa Suenaga wrote:
>> Hi all,
>>
>> We are developing HeapStats [1] with JavaFX 8.
>> This tool uses SwingNode to use JGraphX [2].
>>
>> JGraphX suports Drag & Drop. However, DnD in SwingNode occurs 
>> InvalidDnDOperationException.
>> Callstack of it is same with JDK-8146900.
>>
>> I checked OpenJDK source, the flag of DnD is static field [3].
>> DnD event is trapped at FXDnD, and kick the same event via secondary 
>> event loop.
>> Thus DnD event will be called twice, and second event will be thrown 
>> InvalidDnDOperationException.
>>
>>
>> I think we can fix it as below.
>> However I'm not sure it is correct.
>>
>> Could you help?
>>
>> -------------------
>> diff -r 20164b54e3d8 
>> modules/swing/src/main/java/javafx/embed/swing/FXDnD.java
>> --- a/modules/swing/src/main/java/javafx/embed/swing/FXDnD.java Wed 
>> Jun 08 13:34:10 2016 +1200
>> +++ b/modules/swing/src/main/java/javafx/embed/swing/FXDnD.java Wed 
>> Jun 08 22:02:10 2016 +0900
>> @@ -312,6 +312,10 @@
>>              // and then start an AWT nested loop to wait until DnD 
>> finishes.
>>              loop = 
>> java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().createSecondaryLoop(); 
>>
>>              SwingFXUtils.leaveFXNestedLoop(FXDnD.this);
>> +
>> +            // Avoid JDK-8146900
>> +            setDragDropInProgress(false);
>> +
>>              if (!loop.enter()) {
>>                  // An error occured, but there's little we can do 
>> here...
>>              }
>> -------------------
>>
>>
>> Thanks,
>>
>> Yasumasa
>>
>>
>> [1] http://icedtea.classpath.org/wiki/HeapStats
>> [2] https://github.com/jgraph/jgraphx
>> [3] 
>> http://hg.openjdk.java.net/jdk9/dev/jdk/file/4f717d517d9e/src/java.desktop/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java#l77 
>>


More information about the openjfx-dev mailing list