public class BasicTransferable extends Object implements Transferable
Transferable
interface used
to implement drag'n'drop operations. It initially supports no
DataFlavor
s, but they can be added
by using the various add*
methods provided. They should
be called in order of priority (most specific first).Constructor and Description |
---|
BasicTransferable() |
Modifier and Type | Method and Description |
---|---|
void |
addDataSource(DataSource datsrc,
String mimeType)
Adds streamed data.
|
void |
addLocalObject(Object obj,
Class clazz,
String type)
Adds an object which can be transferred within a single JVM.
|
void |
addSerializableObject(Serializable obj,
Class clazz,
String type)
Adds a
Serializable object which can be serialized
and thus passed outside of this JVM. |
void |
addString(String text)
Adds a plain text string.
|
void |
addURL(URL url)
Adds a URL.
|
Object |
getTransferData(DataFlavor flavor) |
DataFlavor[] |
getTransferDataFlavors() |
boolean |
isDataFlavorSupported(DataFlavor flavor) |
public void addLocalObject(Object obj, Class clazz, String type)
obj
- the objectclazz
- the class as which it should be declared in the MIME typetype
- a human-readable description of the typepublic void addSerializableObject(Serializable obj, Class clazz, String type)
Serializable
object which can be serialized
and thus passed outside of this JVM.obj
- the serializable objectclazz
- the class as which it should be declared in the MIME typetype
- a human-readable description of the typepublic void addURL(URL url)
url
- the URLpublic void addString(String text)
text
- the stringpublic void addDataSource(DataSource datsrc, String mimeType)
datsrc
- the DataSource holding the datamimeType
- the MIME type with which the data should declare
itselfpublic DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface Transferable
public boolean isDataFlavorSupported(DataFlavor flavor)
isDataFlavorSupported
in interface Transferable
public Object getTransferData(DataFlavor flavor) throws IOException, UnsupportedFlavorException
getTransferData
in interface Transferable
IOException
UnsupportedFlavorException
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.