|
|
hi ,
i have a situation in my code where i need to delete an object
because , my problem is
i have a jtree , which is getting created each time user click a button
like new jtree(); i m doing this because of my requirements
so each jtree object has Object filename = node.getUserObject(); which gives me what i have selected at tree selection listener's event
so suppose i have clicked a button 3 times so as a result i have 3 instance of jtree and each jtree object has fileName instance variable
so now assume in 1st instance of jtree filename is a.txt
in 2nd its b.txt
and in 3rd it is c.txt
so when i trying to click a download button that button downloads all the three files ie a , b and c.txt
but i dont want that to happen
what i want is that the only file to get downloaded which is there is fileName and that too the fileName which is in current instance of jtree and my code should ignore previous instance of the same jtree
for solving this problem i have removed the actionlistener from the previous jtree's instance which has destroyed but removing is done after download implementation but what if user have just selected the node but not download any file and change the cwd, in that case action listener is not removed and when user try to download any file previous actionlisteners which are ready to accept the event also get triggered and download that file which user have selected peviously and end up with exception coz that file is not in cwd
can any one help me on this please ?