using drag and drop

Hi to everyone. I’m trying to create a custom window class inside my GLCanvas. Ofcourse I’d like drag and drop support for my windows so I can move them around. What listener should I use so I can track mouse motion when a mouse button is pressed? I tried this:


 public void mouseClicked(MouseEvent e) {
      if (e.getID() == MouseEvent.MOUSE_DRAGGED) {
          System.out.println("Mouse Dragged!");
      } else if (e.getButton() == MouseEvent.BUTTON3) {
        //......etc etc

but it doesn’t work. Any help?

Are you dragging and dropping from one window to another window, or are you dragging inside just one window?

The two methods are very different.

Read up in the JDK documentation the following classes:

For drag and drop to another window read about this:
java.awt.dnd.DropTargetListener

For drag and drop inside the same window read about this:
javax.swing.event.MouseInputListener

Actually all dragging and droping is inside the same component. The MouseInputListener is just what I want. Thanks!