-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.2, 1.3.0
-
generic, x86
-
generic, windows_nt
Name: mc57594 Date: 06/30/99
Drag and drop on WinNT and Win95 for local VM objects will only
work if the object is made Serializable. One would expect that
local object transfers (which effectively transfer only an obj.
reference) need not be serializable.
The following transferable will not work if Serializable is removed. drop(DropTargetDropEvent) on the drop listener
will never be called by the DnD subsystem.
public class MyTransferable implements Transferable, ClipboardOwner, Serializable {
DataFlavor m_df;
public MyTransferable()
{
String mimeType = DataFlavor.javaJVMLocalObjectMimeType +
"; class=" + this.getClass().getName();
m_df = new DataFlavor(mimeType, "Davids String");
}
public DataFlavor[] getTransferDataFlavors() {
DataFlavor[] dfs = new DataFlavor[] {m_df};
return dfs;
}
public boolean isDataFlavorSupported( DataFlavor flavor ) {
return ( flavor.equals(m_df) );
}
public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException {
if (flavor.equals(m_df))
{
return this;
}
else
{
throw new UnsupportedFlavorException (flavor);
}
}
public String toString() {
return "MyTransferable";
}
public void lostOwnership(Clipboard clipboard,
Transferable contents) {
System.out.println ("StringTransferable lost ownership of " +
clipboard.getName());
System.out.println ("data: " + contents);
}
}
(Review ID: 84940)
======================================================================
Drag and drop on WinNT and Win95 for local VM objects will only
work if the object is made Serializable. One would expect that
local object transfers (which effectively transfer only an obj.
reference) need not be serializable.
The following transferable will not work if Serializable is removed. drop(DropTargetDropEvent) on the drop listener
will never be called by the DnD subsystem.
public class MyTransferable implements Transferable, ClipboardOwner, Serializable {
DataFlavor m_df;
public MyTransferable()
{
String mimeType = DataFlavor.javaJVMLocalObjectMimeType +
"; class=" + this.getClass().getName();
m_df = new DataFlavor(mimeType, "Davids String");
}
public DataFlavor[] getTransferDataFlavors() {
DataFlavor[] dfs = new DataFlavor[] {m_df};
return dfs;
}
public boolean isDataFlavorSupported( DataFlavor flavor ) {
return ( flavor.equals(m_df) );
}
public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException {
if (flavor.equals(m_df))
{
return this;
}
else
{
throw new UnsupportedFlavorException (flavor);
}
}
public String toString() {
return "MyTransferable";
}
public void lostOwnership(Clipboard clipboard,
Transferable contents) {
System.out.println ("StringTransferable lost ownership of " +
clipboard.getName());
System.out.println ("data: " + contents);
}
}
(Review ID: 84940)
======================================================================
- duplicates
-
JDK-4251938 Transferable for DnD requires that it supports at least one native DataFlavor
-
- Closed
-
-
JDK-4473062 custom DataFlavor works differently on Unix/Linux and Windows
-
- Closed
-
- relates to
-
JDK-4030696 getTransferData() doesn't seem to be called from/for obj implem'ing Transferable
-
- Closed
-