I am trying a very simple override. I just want to add one line of code to importData for a 'text' TransferHandler. My problem is that I can't find the code I need to copy into my override method before my one line of code!
public class JLabelTransferHandler extends TransferHandler
{
private Logger logger; // My error logging class
public JLabelTransferHandler()
{
super("text");
logger = LoggerFactory.getLogger(this.getClass());
}
public boolean importData(TransferSupport support)
{
// WHAT GOES HERE?????
logger.info("Data imported");
return true;
}
}
Per the tutorial, looks like you should first check to see if your component supports transfer of this flavor type, and so you'd call the canImport(...) method (one that you'll likely need to override), and if so, extract the Transferable from the TransferSupport parameter, get its String data and then put it into your JLabel. Simple. Again, the link above shows all.