private void lbx_users_onlineMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbx_users_onlineMouseClicked

        int doubleclickcounter = evt.getClickCount();
        //detects double clicks, makes sure that the right click is not catched
        if (doubleclickcounter == 2 && evt.getButton() != MouseEvent.BUTTON3) {

            //create array list for message destination


            System.out.println("doubleclick");

            //checks if the current tab is the right tab for the selection of the online user list
            if (lbx_users_online.getModel().getElementAt(lbx_users_online.getSelectedIndex()).toString().equals(tabpanel_chathistory.getComponentAt(tabpanel_chathistory.getSelectedIndex()).toString())) {
                System.out.println("message for this tab");
            } else {
                System.out.println("message for other tab...");
                JTextArea newChatTab = new JTextArea();
                newChatTab.setEditable(false);
                //adds a tab to the chathistory panel
                tabpanel_chathistory.addTab(lbx_users_online.getSelectedValue().toString(), newChatTab);
                //sets the selected index to the newest tab
                tabpanel_chathistory.setSelectedIndex(tabpanel_chathistory.getSelectedIndex() + 1);

            }


        }

        if (evt.getButton() == MouseEvent.BUTTON3) {
            System.out.println("Right Click");
            JPopupMenu rightClickMenu = new JPopupMenu();
            rightClickMenu.add("add to conversation");
            rightClickMenu.add("send file...");
            rightClickMenu.show(lbx_users_online, evt.getX(), evt.getY());
            //here a mouselistener has to be added
        }


    }//GEN-LAST:event_lbx_users_onlineMouseClicked