Skip to content

Feature/javafx frontpage #45

Merged
merged 4 commits into from
Mar 12, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public void start(Stage stage) throws Exception {
Scene scene = new Scene(fxmlLoader.load());
stage.setTitle("Help Me Help");
stage.setScene(scene);

stage.setMinHeight(700);
stage.setMinWidth(1100);

stage.show();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package ntnu.systemutvikling.team6.controller;

import java.util.List;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.layout.FlowPane;
import ntnu.systemutvikling.team6.models.Charity;

public class FrontpageController {

@FXML private FlowPane cardsContainer;

@FXML
public void initialize() {
try {

List<Charity> charities =
List.of(
new Charity("Redd Barna",
"Protecting children's rights worldwide.",
"Children"),
new Charity("Leger Uten Grenser",
"Emergency medical aid in crisis areas.",
"Health"),
new Charity(
"Kirkens Nødhjelp",
"Humanitarian aid and long-term development work.",
"Emergency Aid"));

for (Charity ch : charities) {

FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/organizationCard.fxml"));

Parent card = loader.load();

OrganizationCardController cardController = loader.getController();

cardController.setOrganization(ch.getName(), ch.getDescription());

cardsContainer.getChildren().add(card);
}

} catch (Exception e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ntnu.systemutvikling.team6.controller;

import javafx.fxml.FXML;
import javafx.scene.control.Label;

public class OrganizationCardController {

@FXML private Label organizationName;

@FXML private Label organizationDescription;

public void setOrganization(String name, String description) {
organizationName.setText(name);
organizationDescription.setText(description);
}
}
154 changes: 77 additions & 77 deletions helpmehelpapplication/src/main/resources/fxml/frontPage.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@

<?import javafx.geometry.Insets?>
<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Separator?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.Blend?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>

<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="900.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1">
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="900.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ntnu.systemutvikling.team6.controller.FrontpageController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
Expand Down Expand Up @@ -150,15 +153,77 @@
</VBox>
</children>
</HBox>
<HBox layoutX="10.0" layoutY="10.0" prefHeight="100.0" prefWidth="200.0">
<StackPane prefHeight="150.0" prefWidth="1850.0" style="-fx-background-color: rgba(47, 143, 139, 0.5); -fx-background-radius: 35; -fx-border-color: #3f8f90; -fx-border-radius: 35; -fx-border-width: 2; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.25), 10, 0.2, 0, 4);">
<VBox.margin>
<Insets left="20.0" right="20.0" />
</VBox.margin>
<children>
<Rectangle arcHeight="45.0" arcWidth="45.0" fill="#2f8f8b" height="110.0" stroke="BLACK" strokeType="INSIDE" width="800.0">
<HBox.margin>
<Insets bottom="5.0" left="20.0" right="20.0" top="5.0" />
</HBox.margin>
</Rectangle>
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="40.0" StackPane.alignment="CENTER_LEFT">
<padding>
<Insets bottom="20.0" left="30.0" right="30.0" top="20.0" />
</padding>
<children>
<Button mnemonicParsing="false" style="-fx-background-color: transparent; -fx-font-size: 42; -fx-text-fill: black;" text="&lt;">
<font>
<Font size="42.0" />
</font>
</Button>
<Region prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS" />
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
<StackPane prefHeight="220.0" prefWidth="370.0">
<children>
<VBox fillWidth="false" spacing="20.0" StackPane.alignment="CENTER_LEFT">
<children>
<Label text="Organisasjon" textFill="WHITE" VBox.vgrow="ALWAYS">
<font>
<Font size="36.0" />
</font>
</Label>
<Label maxWidth="500.0" text="Beskrivelse" textFill="WHITE" wrapText="true" VBox.vgrow="ALWAYS">
<font>
<Font size="22.0" />
</font>
</Label>
<HBox prefHeight="50.0" prefWidth="150.0" style="-fx-background-color: rgba(47, 143, 139, 1); -fx-background-radius: 30; -fx-padding: 10 18 10 18;">
<children>
<Label text="" textFill="LIME">
<font>
<Font size="16.0" />
</font>
</Label>
<Label text="Verified by IK" textFill="WHITE">
<font>
<Font size="16.0" />
</font>
<HBox.margin>
<Insets left="5.0" />
</HBox.margin>
</Label>
</children>
</HBox>
</children>
</VBox>
</children>
</StackPane>
<Region prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS" />
<VBox alignment="CENTER" prefHeight="152.0" prefWidth="301.0" spacing="18.0">
<children>
<Button mnemonicParsing="false" style="-fx-background-color: #2E7D32; -fx-text-fill: white; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-radius: 30; -fx-padding: 15 35 15 35; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.2), 8, 0.2, 0, 3);" text="Donate Now" />
<Button mnemonicParsing="false" style="-fx-background-color: #163AA8; -fx-text-fill: white; -fx-font-size: 16; -fx-font-weight: bold; -fx-background-radius: 30; -fx-padding: 15 35 15 35; -fx-effect: dropshadow(gaussian, rgba(0,0,0,0.2), 8, 0.2, 0, 3);" text="View details" />
</children>
</VBox>
<Button alignment="CENTER_RIGHT" contentDisplay="RIGHT" mnemonicParsing="false" prefHeight="58.0" prefWidth="82.0" style="-fx-background-color: transparent; -fx-font-size: 42; -fx-text-fill: black;" text="&gt;">
<font>
<Font size="42.0" />
</font>
</Button>
</children>
<effect>
<Blend />
</effect>
</HBox>
</children>
</HBox>
</StackPane>
<HBox layoutX="10.0" layoutY="10.0" prefWidth="1000.0">
<children>
<VBox prefHeight="300.0" prefWidth="150.0" style="-fx-background-color: transparent; -fx-border-color: #2F8F8B; -fx-background-radius: 10; -fx-border-radius: 10; -fx-border-width: 2;">
Expand Down Expand Up @@ -220,78 +285,13 @@
</CheckBox>
</children>
</VBox>
<ScrollPane fitToWidth="true" prefWidth="900.0">
<ScrollPane fitToWidth="true" prefWidth="900.0" HBox.hgrow="ALWAYS">
<content>
<GridPane hgap="20.0" vgap="20.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<FlowPane fx:id="cardsContainer" hgap="20.0" prefHeight="200.0" prefWidth="200.0" vgap="20.0">
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
<children>
<VBox prefHeight="200.0" prefWidth="100.0" GridPane.columnIndex="1">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
<Separator prefWidth="200.0" />
<Label text="Title" />
<Label text="Description" />
<HBox prefHeight="100.0" prefWidth="200.0" />
</children>
</VBox>
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
<Separator prefWidth="200.0" />
<Label text="Title" />
<Label text="Description" />
<HBox prefHeight="100.0" prefWidth="200.0" />
</children>
</VBox>
<VBox prefHeight="200.0" prefWidth="100.0" GridPane.rowIndex="1">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
<Separator prefWidth="200.0" />
<Label text="Title" />
<Label text="Description" />
<HBox prefHeight="100.0" prefWidth="200.0" />
</children>
</VBox>
<VBox prefHeight="200.0" prefWidth="100.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
<Separator prefWidth="200.0" />
<Label text="Title" />
<Label text="Description" />
<HBox prefHeight="100.0" prefWidth="200.0" />
</children>
</VBox>
<VBox prefHeight="200.0" prefWidth="100.0" GridPane.rowIndex="2">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
<Separator prefWidth="200.0" />
<Label text="Title" />
<Label text="Description" />
<HBox prefHeight="100.0" prefWidth="200.0" />
</children>
</VBox>
<VBox prefHeight="200.0" prefWidth="100.0" GridPane.columnIndex="1" GridPane.rowIndex="2">
<children>
<ImageView fitHeight="150.0" fitWidth="200.0" pickOnBounds="true" preserveRatio="true" />
<Separator prefWidth="200.0" />
<Label text="Title" />
<Label text="Description" />
<HBox prefHeight="100.0" prefWidth="200.0" />
</children>
</VBox>
</children>
</GridPane>
</FlowPane>
</content>
</ScrollPane>
</children>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="240.0" prefWidth="380.0" spacing="12.0" style="-fx-background-color: white; -fx-background-radius: 20; -fx-border-radius: 20; -fx-border-color: #3b82f6; -fx-border-width: 2;" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ntnu.systemutvikling.team6.controller.OrganizationCardController">
<padding>
<Insets bottom="12.0" left="12.0" right="12.0" top="12.0" />
</padding>
<children>
<HBox prefHeight="100.0" prefWidth="200.0" spacing="10.0">
<children>
<ImageView fitHeight="60.0" fitWidth="60.0" pickOnBounds="true" preserveRatio="true" />
<Region prefHeight="200.0" prefWidth="200.0" HBox.hgrow="ALWAYS" />
<Label style="-fx-background-color: #cdedcf; -fx-background-radius: 12; -fx-padding: 4 10 4 10; -fx-text-fill: #2e7d32; -fx-font-size: 12;" text="Verified" />
</children>
</HBox>
<Label fx:id="organizationName" text="Organization name">
<font>
<Font name="System Bold" size="26.0" />
</font>
</Label>
<Label fx:id="organizationDescription" prefWidth="300.0" text="Some interesting information about the organization" wrapText="true" />
<Region prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS" />
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="12.0">
<children>
<Button mnemonicParsing="false" prefWidth="110.0" style="-fx-background-color: #2e7d32; -fx-background-radius: 16; -fx-text-fill: white; -fx-font-weight: bold;" text="Donate" />
<Button mnemonicParsing="false" prefWidth="110.0" style="-fx-background-color: #2563eb; -fx-background-radius: 16; -fx-text-fill: white; -fx-font-weight: bold;" text="View details" />
</children>
</HBox>
</children>
</VBox>