public FriendsPanel(Collection<Friend> friends) {
    this.setLayout(friendsLayout);

    menu.add(addFriendItem);
    menu.addSeparator();
    menu.add(logOutMenuItem);
    menu.addSeparator();
    menu.add(exitItem);
    menuBar.add(menu);

    layoutConstraints.gridx = 0;
    layoutConstraints.gridy = 0;
    layoutConstraints.weightx = 1;
    layoutConstraints.gridwidth = 4;
    layoutConstraints.fill = GridBagConstraints.HORIZONTAL;
    layoutConstraints.anchor = GridBagConstraints.NORTHWEST;
    this.add(menuBar, layoutConstraints);

    layoutConstraints.gridx = 0;
    layoutConstraints.gridy = 1;
    onlineFriendsLabel.setText(ONLINE_FRIENDS);
    this.add(onlineFriendsLabel, layoutConstraints);

    setListOfFriends(friends);
    redisplayListOfFriends();

    friendsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    friendsList.setLayoutOrientation(JList.VERTICAL);
    friendsList.setFont(new Font("Arial", Font.BOLD, 16));

    layoutConstraints.weightx = 1;
    layoutConstraints.weighty = 1;
    layoutConstraints.fill = GridBagConstraints.BOTH;
    layoutConstraints.gridx = 0;
    layoutConstraints.gridy = 2;
    friendsScrollPane = new JScrollPane(friendsList);
    this.add(friendsScrollPane, layoutConstraints);

    layoutConstraints.weightx = 0;
    layoutConstraints.weighty = 0;
    layoutConstraints.gridwidth = 1;
    layoutConstraints.gridx = 0;
    layoutConstraints.gridy = 3;
    layoutConstraints.fill = GridBagConstraints.NONE;
    ImageIcon image = new ImageIcon(FRIENDS_VISIBILITY_BUTTON_ICON);
    changeOnlineFriendsViewButton.setPreferredSize(new Dimension(21, 19));
    changeOnlineFriendsViewButton.setIcon(image);
    changeOnlineFriendsViewButton.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    changeOnlineFriendsViewButton.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        showOnlineFriends = !showOnlineFriends;
        redisplayListOfFriends();
      }
    });
    this.add(changeOnlineFriendsViewButton, layoutConstraints);

    layoutConstraints.gridx = 1;
    layoutConstraints.gridy = 3;
    image = new ImageIcon(SEARCH_ICON);
    searchLogo.setIcon(image);
    searchLogo.setPreferredSize(new Dimension(25, 19));
    this.add(searchLogo, layoutConstraints);

    searchTextField.addKeyListener(new SearchFriendKeyListener());
    layoutConstraints.gridwidth = 2;
    layoutConstraints.gridx = 2;
    layoutConstraints.gridy = 3;
    layoutConstraints.fill = GridBagConstraints.HORIZONTAL;
    this.add(searchTextField, layoutConstraints);

    this.setVisible(true);
  }