playingRow now reacts to changes in playlist. Fixed song highlighting not working when stopping playback.
This commit is contained in:
parent
daedca9bf6
commit
b0c1dd10bc
@ -158,7 +158,8 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf
|
||||
@Override
|
||||
public void setSongHighlighting(Song playingSong) {
|
||||
int index = playlistTableModel.getSongIndex(playingSong);
|
||||
SwingUtilities.invokeLater(() -> playList.setRowSelectionInterval(index, index));
|
||||
if(index >= 0)
|
||||
SwingUtilities.invokeLater(() -> playList.setRowSelectionInterval(index, index));
|
||||
playlistTableModel.setPlayingRow(index);
|
||||
}
|
||||
|
||||
@ -201,7 +202,10 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf
|
||||
playlistTableModel.removeSong(invalidSong);
|
||||
}
|
||||
|
||||
public void playerStopped(){ playlistTableModel.setPlayingRow(-1); }
|
||||
public void playerStopped(){
|
||||
setSongHighlighting(player.getCurrentSong());
|
||||
playlistTableModel.setPlayingRow(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the library with songs in the currently selected display format.
|
||||
|
@ -114,6 +114,10 @@ public class PlaylistTableModel extends AbstractTableModel {
|
||||
if(songList.size() > index && index >= 0){
|
||||
songList.remove(index);
|
||||
fireTableRowsDeleted(index, index);
|
||||
if(index < playingRow)
|
||||
playingRow--;
|
||||
else if(playingRow == index)
|
||||
playingRow = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user