diff --git a/src/main/java/de/hsfulda/onses/controllers/CardController.java b/src/main/java/de/hsfulda/onses/controllers/CardController.java index c84835d..1ef955e 100644 --- a/src/main/java/de/hsfulda/onses/controllers/CardController.java +++ b/src/main/java/de/hsfulda/onses/controllers/CardController.java @@ -1,17 +1,37 @@ package de.hsfulda.onses.controllers; import de.hsfulda.onses.Main; +import de.hsfulda.onses.models.Card; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; +import javafx.scene.control.Label; +import javafx.scene.layout.Pane; import java.io.IOException; import java.util.Objects; public class CardController implements Controller { + + private Card card; + + public CardController(Card card) { + this.card = card; + } @Override public Parent render() throws IOException { final Parent parent = FXMLLoader.load(Objects.requireNonNull(Main.class.getResource("views/card.fxml"))); + Pane mainPane = (Pane) parent.lookup("#cardPane"); + + mainPane.setStyle(addStyle(mainPane.getStyle(), "-fx-background-color: red")); + + final Label cardName = (Label) parent.lookup("#labelName"); + cardName.setText(this.card.getValue().name()); + return parent; } + + private String addStyle(String oldStyle, String newStyle) { + return oldStyle + "; " + newStyle; + } } diff --git a/src/main/resources/de/hsfulda/onses/views/card.fxml b/src/main/resources/de/hsfulda/onses/views/card.fxml index fd33361..4d7f84d 100644 --- a/src/main/resources/de/hsfulda/onses/views/card.fxml +++ b/src/main/resources/de/hsfulda/onses/views/card.fxml @@ -1,13 +1,19 @@ - - - - - - - + + + + + + + + + + +