@SuppressWarnings({ "rawtypes", "serial", "unchecked" })
	public JList<String> deleteFiles(JList<String> l)
    {
        list = l;
        if(list.getMaxSelectionIndex() == -1)
            JOptionPane.showMessageDialog(null, "Please select files to be deleted! ", "DrCleaner" ,JOptionPane.INFORMATION_MESSAGE); 
        else
        {
            int j = JOptionPane.showConfirmDialog(null, 
                    "Are you sure you want to delete selected fles? ", 
                    "DrCleaner", 
                    JOptionPane.YES_NO_OPTION);
            if( j == JOptionPane.YES_OPTION)    
            {
                long space = 0;
                int numOfFilesThatCouldntDelete = 0;
                int numOfselected = 0;
                final Vector<String> temp = new Vector<String>();
                for(int i = 0; i < list.getModel().getSize(); i++)
                { 
                    if(list.isSelectedIndex(i))
                    {
                        numOfselected++;                   
                        File f = new File((String)list.getModel().getElementAt(i));                
                        space += f.length(); 
                        try
                        {
	                        if(!f.delete())                
	                        {                                                   
	                            space -= f.length();                                    
	                            numOfFilesThatCouldntDelete++;
	                        } 
                        }
                        catch (SecurityException e) {
							// TODO: handle exception
                        	e.printStackTrace();
						}
                    }
                    else
                        temp.add((String)list.getModel().getElementAt(i));
                }
                
                list.setModel(new javax.swing.AbstractListModel() {
                    public int getSize() {
                        return temp.size();                        
                    }
                    public Object getElementAt(int i) {
                        return temp.get(i);
                    }
                });
                list.repaint();
                String str = "From " + numOfselected + " selected files, " 
                        + (numOfselected - numOfFilesThatCouldntDelete) +
                        " were deleted\n Total saved space is: " + (space/1024)+"KB";
                JOptionPane.showMessageDialog(null, str, "DrCleaner" ,JOptionPane.INFORMATION_MESSAGE);
                if(temp.isEmpty())
                {
                    JOptionPane.showMessageDialog(handlerFrame,                                                         
                        "You have no more files to handle", "DrCleaner",                                                                           
                        JOptionPane.INFORMATION_MESSAGE);
                    handlerFrame.dispose();
                }
            }
        }
        return list;
    }