• Post Reply Bookmark Topic Watch Topic
  • New Topic

Overriding default DND implementation

 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on DND in a JTable. I can't figure out where or how the dragAction gets set. The default behavior for DND seems to be to allow dragging at all times. But I need the basic table dragging behavior to extend the selection, and allow DND only with a modifier key. Any ideas how to do this?? My predecessor on this project got it working by essentially creating his own dragRecognizer from scratch, but I would think you could override the existing one somehow. I can't seem to get it to work, though.
Thanks for any tips!
 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay here's what I did:
I went into BasicTableUI, and made a copy of it and put it in my package. Then I commented out the mouseDragged() method of its mouseListener. I'm going to clean this up if I can, and make it a small class that extends BasicTableUI, if I can figure out how to remove the existing listener, or override the method that adds it in the first place. Then in my dragOver() and drop() methods, I implement the selection change, as well as copy and paste while dragging.
My only remaining problem is that I can't get the cursors to change from their defaults. I can see my cursors fighting with the default cursors, but the defaults are winning.....
hope this helps somebody someday.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!