void playPrevious() { if (playStack.size() < 2) return; System.out.println("------------"); for (PlaylistAndTrack pnt : playStack) { System.out.println(pnt.track.getTitle()); } playStack.removeFirst(); PlaylistAndTrack prevPlaylistAndTrack = playStack.removeFirst(); playlistsView.getSelectionModel().select(prevPlaylistAndTrack.playlist); tracksView.getSelectionModel().select(prevPlaylistAndTrack.track); tracksView.scrollTo(tracksView.getSelectionModel().getSelectedIndex()); playTrack(prevPlaylistAndTrack.track); }
void pushToPlayStack(Playlist p, Track t) { if (playStack.size() > 10000) { playStack.removeLast(); } playStack.push(new PlaylistAndTrack(p, t)); }