add PlaylistController.java

This commit is contained in:
2026-05-27 11:32:44 -07:00
parent ae8efc62f0
commit 437ba68405
@@ -1,4 +1,31 @@
package sbu.javafx;
public class PlayListController {
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
public class PlaylistController {
@FXML public TableView<Song> playListTable;
@FXML public TableColumn<Song, String> titleCol;
@FXML public TableColumn<Song, String> artistCol;
@FXML public TableColumn<Song, String> durationCol;
private ObservableList<Song> playlist;
@FXML
public void initialize() {
titleCol.setCellValueFactory(new PropertyValueFactory<>("title"));
artistCol.setCellValueFactory(new PropertyValueFactory<>("artistName"));
durationCol.setCellValueFactory(new PropertyValueFactory<>("duration"));
}
public void setPlaylist(ObservableList<Song> playlist) {
this.playlist = playlist;
playListTable.setItems(this.playlist);
}
}