I'm new to java and javafx so I am still learning. I can get the images to display on a horizontal line but I can't make it selectable. I'm not sure if I am using the wrong layout or if I am missing something in the code.
Code
List<Image> movieImages= movieDetails.movieImages(jsonRequest);
ObservableList<Image> movies = FXCollections.observableList(movieImages);
for(int i=0; i < movies.size(); i++){
ImageView imageView;
imageView = new ImageView(movies.get(i));
hboxFanart.getChildren().addAll(imageView);
}
FMXL
<Tab closable="false" text="Fanart">
<ScrollPane>
<HBox fx:id="hboxFanart" spacing="10">
</HBox>
</ScrollPane>
</Tab>
I altered @ItachiUchiha answer from here
As @James_D suggests, try using a
ListView. Set theListVieworientation to horizontal.Some links seem to be broken, but the ideas behind this are the same.
Output
Based on your comment, I created an example using a POJO. That's assuming I understand what you are asking. The POJO keeps up with the name and image. That eliminates the need to have the
Switch-Statement.Code
POJO