public ChatController() {
		
		settings = Settings.getInstance();
		participantList = ParticipantList.getInstance();
		chatHistory = ChatHistory.getInstance();
		chatCore = new ChatCore();
		
		chatGui = new ChatGui();
		trayView = new TrayView();
		settingsGui = new SettingsGui();
		
		chatGui.addChatGuiListener(this);
		trayView.addChatGuiListener(this);
		settingsGui.addSettingsGuiListener(this);
		
		chatCore.addObserver(chatGui);
		chatCore.addObserver(trayView);
		participantList.addObserver(chatGui);
		participantList.addObserver(trayView);
		chatHistory.addObserver(chatGui);
		chatHistory.addObserver(trayView);
		settings.addObserver(settingsGui);
		settings.addObserver(chatGui);
		settings.addObserver(trayView);
		
		Boolean minimizeToTray = Boolean.parseBoolean(settings.getProperty("minimizeToTray"));
		if(minimizeToTray && trayView.isSupported()) {
			addIconToTrayBar();
		}
		
		
		chatGui.addWindowListener( new WindowAdapter () { 
			public void windowClosing(WindowEvent event) {
				Boolean minimizeToTray = Boolean.parseBoolean(settings.getProperty("minimizeToTray"));
				if(minimizeToTray) {
					if (trayView.isSupported()) {
						chatGui.setVisible(false);	
						trayView.setChatGuiMinimizedToTray(true);
					} else {
						quitProgram();
					}
				} else {
					quitProgram();
				}
			}
			
		});
	}