-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
sparc
-
solaris_2.6
Name: auR10023 Date: 12/15/2000
javax.swing.TransferHandler.createTransferable(JComponent ) method returns null
for JComponent which does not contain property, specified in TransferHandler
constructor.
This behavior is not reflected in the javadoc:
...
createTransferable
protected Transferable createTransferable(JComponent c)
Create a Transferable to use as the source for a data transfer.
Parameters:
c - The component holding the data to be transfered. This argument is provided to
enable sharing of TransferHandlers by multiple components.
Returns:
The representation of the data to be transfered.
...
Here is the example:
----------t.java------------
import java.awt.*;
import java.awt.datatransfer.*;
import javax.swing.*;
public class t{
public static void main(String [] args) {
TestComp comp = new TestComp();
TestHand testHandler = new TestHand("property");
System.out.println(testHandler.createTransferable(comp));
}
}
class TestHand extends TransferHandler {
public TestHand(String prop) {
super(prop);
}
public Transferable createTransferable(JComponent c) {
return super.createTransferable(c);
}
}
class TestComp extends JComponent implements java.io.Serializable {
// There is no "property"
}
-------output------
null
======================================================================