Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Drag and Drop between JFrames freezes

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys
I'm trying to do a Drag and Drop between two JFrames, but my application freezes totally when I drag from one JFrame to another.
The DnD source is a JFrame with a JTable that implements DragGestureListener. The target is a JFrame with a JTable that implements DropTargetListener and DragGestureListener. I just want a very simple DnD without DataFlavors and Transferables, in other words I am happy if I get the selected line numbers from the source table. I have succeeded in doing this with two JTables within the same JFrame. But now I have two JFrames and the freeze occurs.
It occurs the second I drag the selected lines over the source JFrame (not the actual JTable). The application then takes 100% CPU time and can only be killed via Windows Task Manager (W2000). On XP Pro, the application can't be killed at all!!! No Exceptions are thrown.
Has anyone come across this scenario before and could give me a hint of direction?
Regards and thanks,
Steffen
 
Steffen Foldager
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I managed to isolate the Thread that used 100% CPU and here is the call stack. It doesn't make much sense to me, I'm afraid..
Thread [AWT-Windows] (Suspended)
sun.awt.windows.WToolkitThreadBlockedHandler.startSecondaryEventLoop() line: not available [native method]
sun.awt.windows.WToolkitThreadBlockedHandler.enter() line: 296
sun.awt.windows.WDropTargetContextPeer(sun.awt.dnd.SunDropTargetContextPeer).handleEnterMessage(java.awt.Component, int, int, int, int, long[], long) line: 281
sun.awt.windows.WToolkit.eventLoop() line: not available [native method]
sun.awt.windows.WToolkit.run() line: 240
java.lang.Thread.run() line: 536
 
Steffen Foldager
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HURRRAAH!
This one took me quite a while, so I thought I might share my joy with the rest of you:
The reason for the freeze was that I was dragging from a JDialog that was modal to the JFrame I was dropping to.
So remember this: Dragging from JDialogs into modal parent frames is BAD!!! (At least in Java 1.4)
Steffen
 
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic