public ChatWindow(Connector connector, final ChatInfo chatInfo) {
		this.con = connector;
		this.chatInfo = chatInfo;
		this.transferManager = new FileTransferManager(chatInfo, connector);
		transferManager.addFileTransferObserver(transfrObserver);
		setTitle(FriendsListWindow.TITLE);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		this.addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {
				transferManager.cancelAllTransfers();
			}
		});
		
		setBounds(100, 100, 497, 353);
		
		//initialize the contentPane
		initContentPanel();
		
		
		historyMsglist = new ChatHistoryList();  
		
		historyMsglist.addListSelectionListener(new ListSelectionListener() {
			
			@Override
			public void valueChanged(ListSelectionEvent e) {
				UIMessage smsg = historyMsglist.getSelectedValue();
				
				if(!(smsg instanceof UIFileMessage)) {
					return;
				}
				UIFileMessage fUiMsg = (UIFileMessage)smsg;
				
				if(fUiMsg.getAutor().equals(chatInfo.getUserName())) { // this side is the sender
					
				}
				else { // this side is the receiver
					
					int choice = showFileAcceptDialog();
					
					if(choice == JOptionPane.YES_OPTION) {
						File outputFile = chooseOutputFile();
						if(outputFile != null) {
							try {
								outputFile.createNewFile();// creates a new file if file with that name does not exist
								transferManager.confirmTransferReceive(fUiMsg.getTransferId(), outputFile);
							} catch (IOException e1) {
								e1.printStackTrace();
							} 
						}
								
					} else if(choice == JOptionPane.NO_OPTION) {
						transferManager.cancelTransferReceive(fUiMsg.getTransferId());
					}
				}
			}
		});
		
		JScrollPane historyMsglistScrollbar = new JScrollPane(historyMsglist);
		historyMsglistScrollbar.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		
		initInputTextArea();
		JScrollPane sbrText = new JScrollPane(inputTextArea);
		sbrText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		
		JPanel chatPanel = makeChatPanel(historyMsglistScrollbar, sbrText);
		chatPanel.setBackground(FriendsListWindow.BACKGROUND);
		contentPane.add(chatPanel, BorderLayout.CENTER);
		
		contentPane.add(makeCommandPanel(), BorderLayout.SOUTH);
	}