Skip to content
Snippets Groups Projects

Add action to button in main and method to get images in controller

Merged Edvard Berdal Eek requested to merge feat/controller into dev
3 files
+ 39
10
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -2,13 +2,26 @@ package no.ntnu.idatt2002.a4.cardgame.controller;
@@ -2,13 +2,26 @@ package no.ntnu.idatt2002.a4.cardgame.controller;
import javafx.fxml.FXML;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.Label;
 
import javafx.scene.image.Image;
 
import no.ntnu.idatt2002.a4.cardgame.model.DeckOfCards;
 
import no.ntnu.idatt2002.a4.cardgame.model.PlayingCard;
 
import no.ntnu.idatt2002.a4.cardgame.view.RightBox;
 
 
import java.util.ArrayList;
 
import java.util.HashMap;
 
import java.util.List;
public class CardGameController {
public class CardGameController {
@FXML
private final DeckOfCards deck = new DeckOfCards();
private Label welcomeText;
private List<PlayingCard> playingCards;
 
 
public List<Image> getImages() {
 
playingCards = deck.dealHand(5);
@FXML
List<Image> images = new ArrayList<>();
protected void onHelloButtonClick() {
for (PlayingCard card : playingCards) {
welcomeText.setText("Welcome to JavaFX Application!");
images.add(card.getCardImage());
 
}
 
return images;
}
}
}
}
\ No newline at end of file
Loading