Restricted library to playlist functionality to left clicks.
This commit is contained in:
parent
ea23faa16c
commit
36cc0da306
@ -426,18 +426,15 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf
|
|||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
int selRow = libraryView.getRowForLocation(e.getX(), e.getY());
|
int selRow = libraryView.getRowForLocation(e.getX(), e.getY());
|
||||||
|
if(e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2 && selRow != -1)
|
||||||
try {
|
try {
|
||||||
Object selectedItem = ((DefaultMutableTreeNode) libraryView.getPathForLocation(e.getX(), e.getY()).getLastPathComponent()).getUserObject();
|
Object selectedItem = ((DefaultMutableTreeNode) libraryView.getPathForLocation(e.getX(), e.getY()).getLastPathComponent()).getUserObject();
|
||||||
if (selRow != -1) {
|
if (selectedItem != null) {
|
||||||
if (e.getClickCount() == 2) {
|
if (selectedItem instanceof Song) {
|
||||||
if (selectedItem != null) {
|
addToPlaylist((Song) selectedItem);
|
||||||
if (selectedItem instanceof Song) {
|
} else if (selectedItem instanceof Album) {
|
||||||
addToPlaylist((Song) selectedItem);
|
((Album) selectedItem).getSongs().forEach(PlayerGUI.this::addToPlaylist);
|
||||||
} else if (selectedItem instanceof Album) {
|
|
||||||
((Album) selectedItem).getSongs().forEach(PlayerGUI.this::addToPlaylist);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (NullPointerException ignored) {
|
} catch (NullPointerException ignored) {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user