private void jBAddMusicPLaylistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAddMusicPLaylistActionPerformed
        System.out.println("Aqui");
        final JTable tabela = p.getPnTabelaMusica().getTblMusic();
        int rowIndex = tabela.getSelectedRow();
        int playlistIndex = p.getPnColuna().getMyPlaylistsList().getSelectedIndex();
     
        int cod = p.getPnTabelaMusica().getCliqueMusica();
        this.m = p.getApp().searchMusic(cod);

        System.out.println("Logado: " + p.getLogged().toString());
        System.out.println("NumPlaylists do logged: " + p.getLogged().getPlaylists().size());

        if (playlistIndex != -1 && p.getPnColuna().getPlaylistProp().
                get(playlistIndex).existeMusicPlaylist(cod)) {
            JOptionPane.showMessageDialog(this, "The music was already added to this playlist before",
                    "ERROR", JOptionPane.ERROR_MESSAGE);
        } else {
            if (rowIndex == -1 && playlistIndex == -1) {
                JOptionPane.showMessageDialog(this, "Please select one music from the table and a Playlist from MyPlaylist.",
                        "ERROR", JOptionPane.ERROR_MESSAGE);
            } else if (rowIndex == -1 && playlistIndex != -1) {
                JOptionPane.showMessageDialog(this, "Please select one music from the table",
                        "ERROR", JOptionPane.ERROR_MESSAGE);
            } else if ( playlistIndex == -1 && rowIndex != -1) {
                JOptionPane.showMessageDialog(this, "Please select one playlist from \"My Playlist\" list",
                        "ERROR", JOptionPane.ERROR_MESSAGE);
            } else {
                Playlist playlist = p.getPnColuna().getPlaylistProp().get(playlistIndex);
                playlist.addMusicPlaylist(cod);
                
                JOptionPane.showMessageDialog(this, "Music added to playlist " + playlist.getName(), "Success", JOptionPane.INFORMATION_MESSAGE);
                p.getPnTabelaMusica().getTblMusic().clearSelection();
                p.getPnColuna().getMyPlaylistsList().clearSelection();
                
                p.revalidate();
                p.repaint();
            }
        }
        
    }//GEN-LAST:event_jBAddMusicPLaylistActionPerformed