Hello all: 
 
I have an application( MyAplication ) with a JSplitPane. On the left side ( of JSplitPane) I have a class DndTree that extends JTree and implements DragSourceListener and DragGestureListener. On the right side I have a JInternalFrame containing a JPanel with other componets like JTable and JTextArea. My application makes Drag and Drop from the DndTree to the JInternalFrame as long as the DndTree is not serialiced (without problems). DndTree is serialized when leaving the application and restored when starting it (MyAplication) with method returdTree( ). This work is fine. 
My problem is: 
Once the application is started and the DndTree is restored the Drag and Drop does not work. Method  " dragGestureRecognized( ) " is not triggered when I try to make a Drag action.
Could you help me with this problem???.  
 
Any suggestion will be vastly grateful.  
Please help me !
Thank you
 
This is part of my code:
 
 
public class MyAplication extends JFrame
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 
 DndTree sourceTree = null;
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 
//***************Constructor ******************************************
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 
 sourceTree = returnTree();   
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
 
//********************  Restored DndTree ( file serialized on C:/ SerialTree.ser ) *********************
  public DndTree returdTree( ) {
     String serializeFilename = "C:\SerialTree.ser";
     DndTree t = null;
     File serializeFile = new File(serializeFilename);
     if (serializeFile.exists( ) ) {
         try {
            FileInputStream fileIn = new FileInputStream(serializeFilename);
            ObjectInputStream in = new ObjectInputStream(fileIn);
            t = ( DndTree ) in.readObject();
            System.out.println("entro al existe");
         } catch(IOException ioe) {
         System.out.println("Error reading file: " + ioe);
         }catch(ClassNotFoundException cnfe) {
         System.out.println("No such class: " + cnfe);
         }
     }
 
     else{
      t = new DndTree( );
      }
    return t;
  }
 
//******************** method dragGestureRecognized  *********************
 
public void dragGestureRecognized( DragGestureEvent event) {
 
     Object selected = getLastSelectedPathComponent();
     if ( selected != null ) {
                StringSelection text = new StringSelection( selected.toString());
                 // as the name suggests, starts the dragging
               dragSource.startDrag (event, DragSource.DefaultMoveDrop, text, this);
     } else {
         System.out.println( "nothing was selected");
     }
   }
 
 
Any suggestion will be vastly grateful.  
Please help me 
Thank you

Reply via email to