From d1c9f2be7b2b9840071dd58afbc6f7382a495e41 Mon Sep 17 00:00:00 2001 From: MatheaGjerde Date: Mon, 30 Mar 2026 12:55:30 +0200 Subject: [PATCH] fead: added scrollpanes and formatted amount --- .../group5/app/view/userpage/UserPageView.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/group5/app/view/userpage/UserPageView.java b/src/main/java/edu/group5/app/view/userpage/UserPageView.java index c5d886d..b410761 100644 --- a/src/main/java/edu/group5/app/view/userpage/UserPageView.java +++ b/src/main/java/edu/group5/app/view/userpage/UserPageView.java @@ -12,6 +12,7 @@ import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.control.Label; +import javafx.scene.control.ScrollPane; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; @@ -19,6 +20,7 @@ import javafx.scene.layout.VBox; import javafx.scene.text.Text; +import java.math.RoundingMode; import java.util.*; @@ -73,7 +75,6 @@ private HBox createProfileSection() { profile.setAlignment(Pos.CENTER_LEFT); return profile; } - private VBox createCausesSection() { Text title = new Text("YOUR SUPPORTED CAUSES"); title.getStyleClass().add("section-title"); @@ -99,8 +100,11 @@ private VBox createCausesSection() { } } } + ScrollPane scrollPane = new ScrollPane(causesBox); + scrollPane.setFitToWidth(true); + scrollPane.setPrefHeight(150); - return new VBox(10, title, causesBox); + return new VBox(10, title, scrollPane); } private VBox createDonationsSection() { @@ -125,13 +129,17 @@ private VBox createDonationsSection() { String orgName = (org != null) ? org.name() : "Unknown Organization"; Label donationLabel = new Label( - orgName + " • " + donation.amount() + " kr" + " • " + donation.date() + orgName + " • " + donation.amount().setScale(2, RoundingMode.HALF_UP) + " kr" + " • " + + donation.date() + " • " + donation.paymentMethod() ); donationsBox.getChildren().add(donationLabel); } } + ScrollPane scrollPane = new ScrollPane(donationsBox); + scrollPane.setFitToWidth(true); + scrollPane.setPrefHeight(200); - return new VBox(10, title, donationsBox); + return new VBox(10, title, scrollPane); } }