Created
September 16, 2014 19:06
-
-
Save guigarage/dd2add8ad17e43ac74f7 to your computer and use it in GitHub Desktop.
How to use the SimpleMediaListCell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Album implements Media { | |
private String artist; | |
private String coverUrl; | |
private String name; | |
//getter & setter | |
@Override | |
public StringProperty titleProperty() { | |
return new SimpleStringProperty(getName()); | |
} | |
@Override | |
public StringProperty descriptionProperty() { | |
return new SimpleStringProperty(getArtist()); | |
} | |
@Override | |
public ObjectProperty<Image> imageProperty() { | |
return new SimpleObjectProperty<>(new Image(getCoverUrl(), true)); | |
} | |
} | |
//In View class... | |
ListView<Album>listView = new ListView<>(); | |
listView.setCellFactory(v -> new SimpleMediaListCell<>()); | |
listView.setItems(dataModel.getAlbums()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment