Skip to content

Commit

Permalink
fead: added scrollpanes and formatted amount
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheaGjerde committed Mar 30, 2026
1 parent 9625956 commit d1c9f2b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/edu/group5/app/view/userpage/UserPageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
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;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;

import java.math.RoundingMode;
import java.util.*;


Expand Down Expand Up @@ -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");
Expand All @@ -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() {
Expand All @@ -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);
}

}

0 comments on commit d1c9f2b

Please sign in to comment.