private DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir){

        String currentDirectory;
//        try{
            currentDirectory  = destinationDir.getPath();
//        }catch(IOException e){
//            currentDirectory = "no such directory";
//        }

        DefaultMutableTreeNode dbFiles = new DefaultMutableTreeNode(currentDirectory);
        if (curTop != null) { // should only be null at root
            curTop.add(dbFiles);
        }
        LinkedList ol = new LinkedList();
        String[] tmp = dir.list();
        for (int i = 0; i < tmp.length; i++)
            ol.add(tmp[i]);
        Collections.sort(ol, String.CASE_INSENSITIVE_ORDER);
        File f;
        LinkedList files = new LinkedList();
        // Make two passes, one for Dirs and one for Files. This is #1.
        for (int i = 0; i < ol.size(); i++) {
            String thisObject = (String) ol.get(i);
            String newPath;
            if (currentDirectory.equals("."))
                newPath = thisObject;
            else
                newPath = currentDirectory + File.separator + thisObject;
            if ((f = new File(newPath)).isDirectory())
                addNodes(dbFiles, f);
            else
                files.add(thisObject);
        }
        // Pass two: for files.
        for (int fnum = 0; fnum < files.size(); fnum++)
            dbFiles.add(new DefaultMutableTreeNode(files.get(fnum)));
        return dbFiles;
        /*File pa = new File(destinationDir.getAbsolutePath());
        File [] f = pa.listFiles();*/
//        String list[] = new File("/home/alex/").list(new FilenameFilter() {
//            @Override
//            public boolean accept(File dir, String name) {
//                if (name.contains(".txt"))
//                return true;
//                  else return false;//To change body of implemented methods use File | Settings | File Templates.
//            }
//        });
//        Collection<String> listFiles = new ArrayList<String>();
//        listFiles.addAll(Arrays.asList(new File("/home/alex/").list()));
        /*for(int i = 0; i < f.length; i++){
//            System.out.println(list[i]);
//            dbFiles.add(new DefaultMutableTreeNode(list[i]));
            DefaultMutableTreeNode node = new DefaultMutableTreeNode(f[i].getName());
            if(f[i].isDirectory())
                node.setAllowsChildren(true);
            else if(f[i].isFile())
                node.setAllowsChildren(false);
            dbFiles.add(node);
        }*/

//        return dbFiles;
    }