- 1 Share and Enjoy !
- 1.0.1 Clipboard Objects in Testing
- 1.0.2 The ClipBoard Owner Interface:
- 1.0.3 The DataFlavor class
- 1.0.4 The Transferable interface The Transferable interface must be implemented by all classes that you want to send to the clipboard, hence the Clipboard class will only understand classes that have been wrapped by the Transferable interface. The Transferable interface is comprised of three methods: Transferable interface
- 2 Share and Enjoy !
Clipboard Objects in Testing
ClipBoard class is used for a Transferable object and can be used for Cut,Copy,Paste operation.
Local clipboards are only available inside the virtual machine that your applet or application is running. However, unlike some
operating systems that limit you to only one clipboard, Java allows you to have as many local clipboards as you desire. Accessing a particular local clipboard is as easy as referring to it by name.System clipboards are directly linked with the peer operating system, allowing your application to transfer information among
|Class||Deals with everything that is a transferable|
|Interface||Every class that deals with the clipboard must implement this interface. This interface is used to notify when the data originally placed in the clipboard has been overwritten|
|Class||Represents all the data types that transferable support|
|Class||One type of transferable that is supplied with Java|
|Interface||Wrapper to objects passed to the clipboard|
|Class||Exception thrown by transferable for an unsupported data flavor|
|Get the name of the clipboard|
|Set the content of the clipboard along with owner object|
|Get the content of the clipboard in the form of a Transferable object. The object passed as a parameter is the owner|
The ClipBoard Owner Interface:
lostOwnershipmethod could be used to set a flag that informs your application about the availability of the data in the clipboard. Microsoft Word, while not written in Java, is a good example of this mechanism at work in an application. Whenever you put something in the clipboard within Word and then quit, a dialog box appears informing you that data is in the clipboard. You will then be asked if you want to leave the data in the clipboard.
The DataFlavor class
DataFlavorclass is used to represent the type of an object. You’re not limited to one data flavor (or type) per object. And, like us, your objects can have multiple personalities! For example, an image class can be represented as a Java class or as an array of bits (GIF, JPEG, and so on). In reality, a
DataFlavorclass is a wrapper to a MIME type. The MIME standard is extensive, hence there are virtually no limits to the data that can be transferred to the clipboard.
|Test if the DataFlavor supplied is equal to the DataFlavor represented by this class|
|Return the human representable name for the format that this DataFlavor represents|
|Set the human representation name for this DataFlavor|
|Get the MIME type string represented by this DataFlavor|
|Return the Class that represents this class|
The Transferable interface
Transferable interface must be implemented by all classes that you want to send to the clipboard, hence the
Clipboard class will only understand classes that have been wrapped by the
Transferable interface. The
Transferable interface is comprised of three methods:
|Return an array of DataFlavor that represents the object|
|Test if the DataFlavor supplied is supported|
|Return the object represented by the supplied DataFlavor|