0

All the samples I have see that pass a value to the TransferHandler constructor use "text".

  button.setTransferHandler(new TransferHandler("text"));

Checked the docs to see what other values can be passed in but can't find any information other than the value can be null. Are the only two options null and "text"? What are the other options and any reference to any URLs?

Unhandled Exception
  • 1,427
  • 14
  • 30
  • Looking at the [JavaDocs](http://docs.oracle.com/javase/7/docs/api/javax/swing/TransferHandler.html#TransferHandler(java.lang.String)), the constructor TransferHandler(String) is used to *"Construct a transfer handler that can transfer a Java Bean property from one component to another via the clipboard or a drag and drop operation."*, this represents the name of the getter/setter that the handler would call to transfer the data between components. In your case, it sounds like you'll have to do some of the work yourself. – MadProgrammer Jun 29 '15 at 22:01
  • Maybe some more context to the problem you're trying to solve would allow us to suggest possible solutions – MadProgrammer Jun 29 '15 at 22:02
  • I am simply running the simple sample from here :http://zetcode.com/tutorials/javaswingtutorial/draganddrop/ – Unhandled Exception Jun 29 '15 at 22:42
  • Your comment of the getter/setter helps as the sample simply moves text around but since the getter/setters are usually getText() and setText() I would have expected "Text" and not "text" as the value passed to the constructor. – Unhandled Exception Jun 29 '15 at 22:43
  • Yeah, it has to do with the internal works of JavaBeans ;) – MadProgrammer Jun 29 '15 at 22:44
  • For a more "complex" solution, you could have a look at [this](http://stackoverflow.com/questions/13855184/drag-and-drop-custom-object-from-jlist-into-jlabel/13856193#13856193) – MadProgrammer Jun 29 '15 at 22:47

0 Answers0