Skip to content

Commit

Permalink
feat: added images to BrowseCards
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheaGjerde committed Mar 24, 2026
1 parent 632bdcb commit 04c92c4
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/main/java/edu/group5/app/view/browsepage/BrowseCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,32 @@ public BrowseCard(BrowseCardController browseCardController, Organization org, S
private StackPane imageContainer(String img) {
StackPane imageContainer = new StackPane();
imageContainer.setId("imageContainer");

imageContainer.setPrefHeight(80);
imageContainer.setPrefWidth(80);
imageContainer.setMaxWidth(Double.MAX_VALUE);

ImageView logo = new ImageView(
new Image(getClass().getResource(img).toExternalForm())
);

logo.setId("logo");
logo.setSmooth(true);
logo.setPreserveRatio(true);
logo.setFitHeight(80);
if (img != null && !img.isBlank()) {
ImageView logo = new ImageView(new Image(img, true));
logo.setId("logo");
logo.setSmooth(true);
logo.setPreserveRatio(true);
logo.setFitHeight(80);
logo.setFitWidth(80);

imageContainer.getChildren().add(logo);
} else {
StackPane placeholder = new StackPane();
placeholder.setPrefSize(80, 80);

Text text = new Text("No image");
text.setStyle("-fx-font-size: 10;");

placeholder.getChildren().add(text);
imageContainer.getChildren().add(placeholder);
}

imageContainer.getChildren().add(logo);
return imageContainer;
}

Expand Down

0 comments on commit 04c92c4

Please sign in to comment.