Java Reference
In-Depth Information
final ColumnConstraints c0 = new ColumnConstraints();
final ColumnConstraints c1 = new ColumnConstraints();
c1.setHgrow(Priority.ALWAYS);
gp.getColumnConstraints().addAll(c0, c1);
final RowConstraints r0 = new RowConstraints();
r0.setValignment(VPos.TOP);
gp.getRowConstraints().addAll(r0, r0, r0, r0);
return gp;
}
private void createControls() {
artist = new Label();
artist.setId("artist");
album = new Label();
album.setId("album");
title = new Label();
title.setId("title");
year = new Label();
year.setId("year");
final Reflection reflection = new Reflection();
reflection.setFraction(0.2);
final URL url = getClass().getResource("resources/defaultAlbum.png");
final Image image = new Image(url.toString());
albumCover = new ImageView(image);
albumCover.setFitWidth(240);
albumCover.setPreserveRatio(true);
albumCover.setSmooth(true);
albumCover.setEffect(reflection);
}
private void createMedia() {
// As previously shown...
}
private void handleMetadata(String key, Object value) {
// As previously shown...
}
}
The AudioPlayer2 application with the Java Posse podcast's metadata on display is shown in Figure 9-4 . You can
see from the code in Listing 9-9 and the image in Figure 9-4 that we have also added a subtle reflection to the image
that was read from the metadata. Although we don't want to abuse these types of effects, it is really nice that JavaFX
allows us to create them so easily.
Search WWH ::




Custom Search