add PlaylistController.java
This commit is contained in:
@@ -1,4 +1,31 @@
|
|||||||
package sbu.javafx;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user