From d125759c06685d4c3eb0bc4d14d9399614a84d84 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Mon, 29 Feb 2016 02:28:26 +0000 Subject: [PATCH] Pausing now resets the highlighting to the current song. If another entry is then selected before pressing play then that song will be played rather than resuming the paused song. --- src/main/java/musicplayer/PlayerGUI.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/musicplayer/PlayerGUI.java b/src/main/java/musicplayer/PlayerGUI.java index e8d29cf..6203674 100644 --- a/src/main/java/musicplayer/PlayerGUI.java +++ b/src/main/java/musicplayer/PlayerGUI.java @@ -40,7 +40,6 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf public PlayerGUI() { createUI(); - DatabaseManager.init(); resetTree(); Thread seekBarUpdater = new Thread(() -> { boolean running = true; @@ -58,6 +57,7 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf } public static void main(String[] args) { + DatabaseManager.init(); PlayerGUI playerGUI = new PlayerGUI(); JFrame frame = new JFrame(); frame.setContentPane(playerGUI.mainPanel); @@ -347,7 +347,10 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf toolBar.add(playButton); JButton pauseButton = new JButton("Pause"); pauseButton.setMnemonic('E'); - pauseButton.addActionListener(e -> player.pause()); + pauseButton.addActionListener(e -> { + player.pause(); + setSongHighlighting(player.getCurrentSong()); // Resume won't function if a different song is selected. + }); toolBar.add(pauseButton); JButton stopButton = new JButton("Stop"); stopButton.setMnemonic('S');