diff --git a/src/main/java/latice/application/LaticeApplicationWindow.java b/src/main/java/latice/application/LaticeApplicationWindow.java index 9c8afa6..5219ab9 100644 --- a/src/main/java/latice/application/LaticeApplicationWindow.java +++ b/src/main/java/latice/application/LaticeApplicationWindow.java @@ -1,6 +1,7 @@ package latice.application; import java.io.File; +import java.util.ArrayList; import javafx.application.Application; import javafx.geometry.Insets; @@ -15,6 +16,8 @@ import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.stage.Stage; import latice.model.Color; +import latice.model.Deck; +import latice.model.Rack; import latice.model.Shape; import latice.model.Tile; @@ -23,6 +26,8 @@ public class LaticeApplicationWindow extends Application{ Image image = new Image("C:/Users/cemal/saebut1/latice/src/main/resources/laticePlateau.png"); ImageView imageView = new ImageView(image); + + Tile blueBird = new Tile(Color.BLUE, Shape.BIRD); Tile greenLeaf = new Tile(Color.GREEN, Shape.LEAF); Tile redFlower = new Tile(Color.RED, Shape.FLOWER); @@ -45,21 +50,51 @@ public class LaticeApplicationWindow extends Application{ root.setCenter(imageView); //Rack - HBox rack = new HBox(); + HBox rackBox = new HBox(); + + rackBox.setSpacing(10); + rackBox.setPadding(new Insets(15,20, 10,10)); + + + ArrayList listOfTile = new ArrayList(); + + System.out.println("Hello Latice !"); + + + for (Color color : Color.values()) { + for (Shape shape : Shape.values()) { + Tile tile = new Tile(color, shape); + + listOfTile.add(tile); + + } + } + + System.out.println("-----------------"); + System.out.println("Notre Deck :"); + Deck deck = new Deck(listOfTile); + System.out.println("-----------------"); + Rack rack = new Rack(deck); + System.out.println("-----------------"); + //deck.displayListTile(); + + ArrayList listRackTile = Rack.getListRackTile(); - rack.setSpacing(10); - rack.setPadding(new Insets(15,20, 10,10)); Text rackTile1 = new Text(); - rackTile1.setText(blueBird.getShape().toString() + blueBird.getColor()); + rackTile1.setText(listRackTile.get(0).getShape().toString() + listRackTile.get(0).getColor().toString()); Text rackTile2 = new Text(); - rackTile2.setText(greenLeaf.getShape().toString() + greenLeaf.getColor()); + rackTile2.setText(listRackTile.get(1).getShape().toString() + listRackTile.get(1).getColor().toString()); Text rackTile3 = new Text(); - rackTile3.setText(redFlower.getShape().toString() + redFlower.getColor()); + rackTile3.setText(listRackTile.get(2).getShape().toString() + listRackTile.get(2).getColor().toString()); + Text rackTile4 = new Text(); + rackTile4.setText(listRackTile.get(3).getShape().toString() + listRackTile.get(3).getColor().toString()); + Text rackTile5 = new Text(); + rackTile5.setText(listRackTile.get(4).getShape().toString() + listRackTile.get(4).getColor().toString()); - rack.getChildren().addAll(rackTile1, rackTile2, rackTile3); - rack.setAlignment(Pos.CENTER); - root.setBottom(rack); + rackBox.getChildren().addAll(rackTile1, rackTile2, rackTile3, rackTile4, rackTile5); + rackBox.setAlignment(Pos.CENTER); + root.setBottom(rackBox); Scene scene = new Scene(root, 1280, 720); diff --git a/src/main/java/latice/model/Rack.java b/src/main/java/latice/model/Rack.java index 36f0e60..77da402 100644 --- a/src/main/java/latice/model/Rack.java +++ b/src/main/java/latice/model/Rack.java @@ -3,7 +3,7 @@ package latice.model; import java.util.ArrayList; public class Rack { - private ArrayList listRackTile = new ArrayList(); + private static ArrayList listRackTile = new ArrayList(); public Rack(Deck deck) { System.out.println("Il y a dans le rack : " + listRackTile.size() + " valeurs"); @@ -20,6 +20,15 @@ public class Rack { System.out.println("Il y a dans le rack : " + listRackTile.size() + " valeurs"); } + + public static ArrayList getListRackTile() { + return listRackTile; + } + + public void setListRackTile(ArrayList listRackTile) { + this.listRackTile = listRackTile; + } + // TODO add method(s) javafx