Delete Using TransferHandlers

J

Jason Cavett

I'm having an issue with TransferHandlers and I'm really not sure of
the correct/normal solution.

I have implemented cut/copy/paste on various components (via my own
TransferHandlers) throughout my application. This works great because
I can also create menus that trigger cut/copy/paste actions and those
actions get the appropriate TransferHandler and let the TH take care
of the action.

The problem I am having is that I want to be able to do this same
thing with deleting. I'd like a generic way to delete items within a
GUI (whether I'm in a JTree, TextBox or whatever), but I don't know
about the component before I have it.

It seems like TransferHandlers are the best way to do this, but as far
as I can tell, this mechanism isn't provided directly in the TH. Is
there something I'm missing? Do I have to write/roll my own code for
this. It seems to me that a delete is just a move without the copy/
paste aspect (cleanup only), so I figured I could utilize that
somehow.

Any suggestions would be great. Like I said, I could roll my own (and
already have), but it feels very clunky - like I am fighting with the
interface. Additionally, drag and drop has now become more confusing
as a result.


Thanks for any help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top