@Override
    public void actionPerformed(ActionEvent e) {
    	
    	if(e.getSource() == open){ 
	    	int returnVal = fileChooser.showOpenDialog(UI.this);
	
	        if (returnVal == JFileChooser.APPROVE_OPTION) {
	            File file = fileChooser.getSelectedFile();
	            //This is where a real application would open the file.
	            System.out.println("Opening: " + file.getName());
	            try{
	            	Torrent t = TorrentParser.parseTorrentFile(file.getAbsolutePath());
	            	ls.addTorrent(t);
	            }catch(Exception ex){
	            	JOptionPane.showMessageDialog(mainPane, "Invalid torrent file");
	            }
	        } else {
	        	System.out.println("Open command cancelled by user.");
	        }
    	}else if(e.getSource() == magnet){
    		System.out.println("Clicked magent");
    		String ans = JOptionPane.showInputDialog(null, "Magnet Link:");
    		System.out.println("Go fetch: "+ans);
    	}else if(e.getSource() == delete){
    		System.out.println("delete ");
    		System.out.println("Delete "+torrentList.getSelectedRow());
    		ls.deleteTorrentData(ls.getTorrent(torrentList.getSelectedRow()));
			
    		//TODO: Choices...
    	}else if(e.getSource()== stop){
    		System.out.println("stop ");
    		System.out.println("Stop "+torrentList.getSelectedRow());
    		try {
				ls.setTorrentDeactive(ls.getTorrent(torrentList.getSelectedRow()));
			} catch (IOException e1) {
				e1.printStackTrace();
			}
    	}else if(e.getSource() == play){
    		System.out.println("play ");
    		System.out.println("Start "+torrentList.getSelectedRow());
    		//Effectively just reload torrent.
    		try {
				ls.reActivate(ls.getTorrent(torrentList.getSelectedRow()));
			} catch (IOException | NoSuchAlgorithmException e1) {
				e1.printStackTrace();
			}
    		
    		
    	}
    }