public void actionPerformed(ActionEvent e) {
                // Prompt the user to see if they really want to exit.
                int result = JOptionPane.showConfirmDialog(frame,
                        "Are you sure you want to exit the conversation?",
                        "Leave Conversation", JOptionPane.YES_NO_OPTION);

                if (result == JOptionPane.YES_OPTION) {
                    frame.setVisible(false);
                    frame.dispose();
                }
            }