private void jPanel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MouseClicked
        String message = jTextArea1.getText().replace("\n", ""); 
        //sending message 
        try
        {
            String selected = this.getjList1().getSelectedValue().toString().trim();
        
          
            ChatClientConnection chatClient = null;
            String id = null;

            for(User onlineUser: onlineUsers)
            {
                id = onlineUser.getId(); 

                if(id.trim().equals(selected))
                {  try {
                        new ChatClientConnection(onlineUser.getIp(), onlineUser.getUDPServerPort()).sendChatMessage(message);
                    } catch (Exception ex) {
                        Logger.getLogger(MainContent.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    break;
                }
            }    
            chat.getjTextArea1().append("\nME: " + message);
            jTextArea1.setText("\n");
        }
            catch(NullPointerException e)
        {
            new ErrorPanel(" User must be selected \n before sending message!").display();
        }
    }//GEN-LAST:event_jPanel1MouseClicked