Skip to main content

How to implement drag & drop with J2ME CDC

2 replies [Last post]
Joined: 2008-05-15

I would like to use drag & drop in a PDA application.
I would be using J2ME CDC, and I don't find on the J2ME javadoc the interfaces used on J2SE to implement the drag & drop (DragGestureListener, DropTargetListenner,...).

My question is : is there any way to implement the drag & drop using J2ME CDC, and if not how is implemented the drag & drop on the PDA applications (because it seems to me that it's a basic concept of the PDA programmation)?

Thanks in advance for your responses

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-03-04

I am not an expert on DnD but platforms such as phoneME Advanced are CDC/FP/PBP/PP and as such most of the Java SE 1.4.2 functionality, including awt.datatransfer . You could certainly try that.

Hope that helps,

-- Terrence

Joined: 2003-06-15


So JavaME was designed for limited devices, as such incorporating large libraries to support the DnD type features was not included. A rule of thumb is if it wasn't in Java before 1.2 then it most likely isn't in JavaME CDC. I don't work in CDC but rather the CLDC, however you might see if the java.awt.datatransfer package is available to help with the transfer of information. The DnD really become a graphical management issue of working with mouse events. I found this example of the use of the java.awt.datatransfer package, and it looks like it doesn't have code that is outside the 1.1.8 spec.

But if you have a JavaVM that support CDC, you might look at the Gnu ClassPath project, and see if you could use their implementation of the awt.dnd package. All of the bytecode opCodes should be in the VM to support the java portion of the package. If there is native code then you will have troubles.