From 8a69ecac98e7705f493039b829df4a190307a0e4 Mon Sep 17 00:00:00 2001 From: HSoreide <sofie.scisly@gmail.com> Date: Fri, 14 Apr 2023 16:23:28 +0200 Subject: [PATCH] Create RecipeTile to represent suggested recipes with custom css styling --- .../demo/controller/RecipeTileController.java | 4 ++ src/main/resources/style.css | 6 +++ src/main/resources/view/RecipeTile.fxml | 43 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 src/main/java/no/ntnu/idatt1002/demo/controller/RecipeTileController.java create mode 100644 src/main/resources/style.css create mode 100644 src/main/resources/view/RecipeTile.fxml diff --git a/src/main/java/no/ntnu/idatt1002/demo/controller/RecipeTileController.java b/src/main/java/no/ntnu/idatt1002/demo/controller/RecipeTileController.java new file mode 100644 index 00000000..3c29d62c --- /dev/null +++ b/src/main/java/no/ntnu/idatt1002/demo/controller/RecipeTileController.java @@ -0,0 +1,4 @@ +package no.ntnu.idatt1002.demo.controller; + +public class RecipeTileController { +} diff --git a/src/main/resources/style.css b/src/main/resources/style.css new file mode 100644 index 00000000..4cb858ed --- /dev/null +++ b/src/main/resources/style.css @@ -0,0 +1,6 @@ + + +.recipe-tile { + -fx-background-color: rgba(151, 175, 151, 0.8); + -fx-background-radius: 30; +} \ No newline at end of file diff --git a/src/main/resources/view/RecipeTile.fxml b/src/main/resources/view/RecipeTile.fxml new file mode 100644 index 00000000..b4631d84 --- /dev/null +++ b/src/main/resources/view/RecipeTile.fxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.geometry.*?> +<?import javafx.scene.control.*?> +<?import javafx.scene.layout.*?> +<?import javafx.scene.text.*?> + +<AnchorPane id="recipe-tile" prefHeight="300.0" prefWidth="400.0" styleClass="recipe-tile" stylesheets="@../style.css" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="no.ntnu.idatt1002.demo.controller.RecipeTileController"> + <children> + <VBox prefHeight="350.0" prefWidth="500.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <children> + <Pane prefHeight="262.0" prefWidth="500.0"> + <children> + <Label id="recipeTitle" fx:id="nameTag" alignment="CENTER" contentDisplay="CENTER" layoutY="3.0" prefHeight="237.0" prefWidth="400.0" text="Name of Recipe"> + <font> + <Font name="System Bold" size="36.0" /> + </font> + </Label> + </children></Pane> + <HBox prefHeight="88.0" prefWidth="500.0"> + <children> + <Label alignment="CENTER" prefHeight="63.0" prefWidth="292.0" text="Ingredients missing:"> + <font> + <Font size="24.0" /> + </font> + <opaqueInsets> + <Insets left="20.0" right="20.0" /> + </opaqueInsets> + </Label> + <Label id="noMissingIngredients" fx:id="missingTag" alignment="CENTER" contentDisplay="CENTER" prefHeight="69.0" prefWidth="127.0" text="# missing"> + <font> + <Font size="24.0" /> + </font> + </Label> + </children> + <opaqueInsets> + <Insets left="20.0" right="20.0" /> + </opaqueInsets> + </HBox> + </children> + </VBox> + </children> +</AnchorPane> -- GitLab