public ClientController(Client client) {
    this.client = client;

    try {
      client.start();
    }
    catch (IOException e) {
      e.printStackTrace();
      showErrorMessage(SERVER_CONNECTION_ERROR);
      System.exit(1);
    }

    client.registerAuthenticationListener(this);
    client.registerFriendRequestListener(this);
    client.registerRegisterListener(this);
    conversationController = new ConversationController(client);

    loginPanel = new LoginPanel();
    loginPanel.addLoginButtonActionListener(new LoginButtonAction());
    loginPanel.addRegisterLabelMouseListener(new RegisterClicked());
    mainWindow = new JFrame();
    registerPanel = new RegisterPanel();
    registerPanel.addRegisterButtonListener(new RegisterDone());
    registerPanel.addCancelButtonListener(new CancelRegister());
    mainWindow.addWindowListener(new ClientClosing());
    ArrayList<Image> icons = new ArrayList<>();
    icons.add(new ImageIcon(APP_ICON_16).getImage());
    icons.add(new ImageIcon(APP_ICON_64).getImage());
    icons.add(new ImageIcon(APP_ICON_128).getImage());
    mainWindow.setIconImages(icons);
    mainWindow.setContentPane(loginPanel);
    mainWindow.setSize(new Dimension(275, 450));
    mainWindow.setLocation(1050, 170);
    mainWindow.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    mainWindow.setTitle(WINDOW_TITLE);
    mainWindow.setVisible(true);
  }