From d9cfdc37dd0e1d0644d9c1f0b0bf811f7546ee2a Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Mon, 29 Feb 2016 03:38:43 +0000 Subject: [PATCH] Playback is now forcibly stopped if the playlist is cleared. --- src/main/java/musicplayer/PlayerGUI.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/musicplayer/PlayerGUI.java b/src/main/java/musicplayer/PlayerGUI.java index a6ce247..7fffe9d 100644 --- a/src/main/java/musicplayer/PlayerGUI.java +++ b/src/main/java/musicplayer/PlayerGUI.java @@ -321,7 +321,10 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf playList.setComponentPopupMenu(popupMenu); popupMenu = new JPopupMenu(); menuItem = new JMenuItem("Clear all"); - menuItem.addActionListener((e) -> playlistTableModel.removeAll()); + menuItem.addActionListener((e) -> { + playlistTableModel.removeAll(); + player.stop(); + }); popupMenu.add(menuItem); playlistScroll.setComponentPopupMenu(popupMenu); playlistScroll.setViewportView(playList);