public TabPanel(final JFrame window, final JTabbedPane parentPanel, String tabTitle,
        final ConversationPanel addedPanel) {
      this.setLayout(new GridBagLayout());
      GridBagConstraints constraints = new GridBagConstraints();

      this.setOpaque(false);

      title = new JLabel(tabTitle);
      constraints.anchor = GridBagConstraints.WEST;
      constraints.gridx = 0;
      constraints.gridy = 0;
      constraints.weightx = 1;
      constraints.weighty = 1;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      this.add(title, constraints);

      closeButton = new JLabel("x");
      closeButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent event) {
          parentPanel.remove(addedPanel);
          conversationListener.conversationClosed(addedPanel.getIdentifier());
          if (tabbedPanel.getTabCount() == 0) {
            closeWindow();
          }
        }

        @Override
        public void mouseEntered(MouseEvent e) {
          closeButton.setForeground(Color.RED);
        }

        @Override
        public void mouseExited(MouseEvent e) {
          closeButton.setForeground(Color.GRAY);
        }
      });
      closeButton.setForeground(Color.GRAY);
      constraints.anchor = GridBagConstraints.EAST;
      constraints.gridx = 1;
      constraints.gridy = 0;
      constraints.weightx = 0;
      constraints.weighty = 0;
      constraints.fill = GridBagConstraints.NONE;
      this.add(new JLabel("  "), constraints);
      constraints.gridx = 2;
      this.add(closeButton, constraints);
    }