Is it possible to do drag and drop using robot class instead of using TransferHandler class?
What PROBLEM are you trying to solve?
Those are two DIFFERENT classes that are used for different purposes. They can work together; they don't replace one another.
The TransferHandler class provides the mechanism for actually transferring the data.
The Robot is merely used to generat native system events to mimic what a user does. So instead of a user selecting, clicking, dragging and dropping the Robot class can emulate the selecting, clicking, dragging and dropping.
But in both cases it is the TransferHandler class that actually transfers the data.
See the Robot API
This class is used to generate native system input events for the purposes of test automation, self-running demos, and other applications where control of the mouse and keyboard is needed. The primary purpose of Robot is to facilitate automated testing of Java platform implementations.
Using the class to generate input events differs from posting events to the AWT event queue or AWT components in that the events are generated in the platform's native input queue. For example,
Robot.mouseMovewill actually move the mouse cursor instead of just generating mouse move events.
And the Java Tutorials for the TransferHandler class
At the heart of the data transfer mechanism is the
TransferHandlerclass. As its name suggests, the
TransferHandlerprovides an easy mechanism for transferring data to and from a
JComponent— all the details are contained in this class and its supporting classes. Most components are provided with a default transfer handler. You can create and install your own transfer handler on any component.