private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        int index = publicPlaylists.getSelectedIndex();
            
         //pagPrincipal.getPnTabelaMusica().atribuiDados(null);
         
            if (index != -1) {
                
                Playlist p = playlistPub.get(publicPlaylists.getSelectedIndex());
                ArrayList<Music> msc = pagPrincipal.getApp().getMusiclistFromPlaylist(p.getMusics());
                
                pagPrincipal.getPnBaseInfo().removeAll();
                pagPrincipal.getPnBaseTabela().removeAll();
                
                //Preenche a tabela com musicas da playlist seleccionada
                
                pagPrincipal.setPnTabelaMusica(new PnTabelaMusica(pagPrincipal, msc));
                pagPrincipal.getPnBaseTabela().add(pagPrincipal.getPnTabelaMusica());

                //pntm.atribuiDados(msc);
                pagPrincipal.getPnBaseTabela().add(pagPrincipal.getPnTabelaMusica());
                
                
                
                //Preenche cabeçalho
                PnListaMusicas pnlist = new PnListaMusicas(pagPrincipal, p);
                pnlist.getjLabPListName().setText("Playlist " + p.getName());
                pnlist.getjLabPListName1().setText("Number of musics: "+msc.size());
                pagPrincipal.getPnBaseInfo().add(pnlist);
                pagPrincipal.revalidate();
                pagPrincipal.repaint();
                
            }
            
            else{
            
                JOptionPane.showMessageDialog(this, "Please select one playlist.",
                    "ERROR", JOptionPane.ERROR_MESSAGE);
                
            }
    }//GEN-LAST:event_jButton2ActionPerformed