Drag and Drop from editor

Using Intellij IDEA 4.5.3, I can select text in the editor, put my mouse over it, the mouse cursor displays an arrow, I can hold the left mouse button, and drag the text to any native application (such as notepad for Windows). This behaves as if it were a cut/paste operation.

I am trying to simulate this behaviour using my own JTextField (is this an appropriate component? I tried a couple of others) to no avail. I see no functionality offered by javax.swing.TransferHandler, which is where I would have otherwise expected it.

Assuming IDEA is pure Java (as it claims), how can I produce this behaviour using my own components?

1 comment
Comment actions Permalink

I don't know how IDEA is doing it, but have you looked at this page yet?
http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html I haven't,
so I don't know if there is anything new there for you or not, but it was
the first thing that popped into my mind.

Tobin


0

Please sign in to leave a comment.