public void update() { try { _mpd.getMPDAdmin().updateDatabase(); } catch (Exception e) { } DefaultMutableTreeNode parent = (DefaultMutableTreeNode) getRoot(); Iterator<Path> pathIter = null; Path subPath = null; MPDSong song = null; try { Iterator<MPDSong> list = _mpd.getMPDDatabase().listAllSongs().iterator(); parent.removeAllChildren(); while (list.hasNext()) { song = list.next(); pathIter = Paths.get(song.getFile()).iterator(); parent = (DefaultMutableTreeNode) getRoot(); while (pathIter.hasNext()) { subPath = pathIter.next(); if (pathIter.hasNext()) { parent = appendNode(parent, new DefaultMutableTreeNode(subPath)); } else { appendNode(parent, new DefaultMutableTreeNode(new SongContainer(song))); } } } super.reload(); } catch (Exception e) { } }