SHARE
TWEET

Untitled

a guest Jun 19th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package sample;
  2.  
  3. import javafx.fxml.FXML;
  4. import javafx.scene.image.Image;
  5. import javafx.scene.image.ImageView;
  6. import javafx.scene.layout.GridPane;
  7.  
  8. public class SpielbrettGUI {
  9. @FXML
  10. public ImageView iv;
  11. public static void guiBuilder() {
  12.  
  13.     ImageView iv = new ImageView();
  14.     Image background = new Image("file:Dame Rosa.png");
  15.  
  16.     iv.setImage(background);
  17.  
  18. }
  19.  
  20. public static void visual(Dame dame) {
  21.  
  22.     GridPane grid = new GridPane();
  23.     grid.getChildren().addAll();
  24.  
  25.     for (int i = 0; i < 8; i++) {
  26.         for (int j = 0; j < 8; j++) {
  27.             if (dame.getFeld(i, j) == 1) {
  28.                 grid.add(new ImageView(new Image("file:Spielstein Gr├╝n.png")), i, j);
  29.             } else if (dame.getFeld(i, j) == 2) {
  30.                 grid.add(new ImageView(new Image("file:Dame Gr├╝n.png")), i, j);
  31.             } else if (dame.getFeld(i, j) == 3) {
  32.                 grid.add(new ImageView(new Image("file:Spielstein Rosa.png")), i, j);
  33.             } else if (dame.getFeld(i, j) == 4) {
  34.                 grid.add(new ImageView(new Image("file:Dame Rosa.png")), i, j);
  35.             } else if (dame.getFeld(i, j) == 10) {
  36.                 grid.add(new ImageView(), i, j);
  37.  
  38.             }
  39.         }
  40.     }
  41.  
  42.  }
  43.  
  44. }
  45.      
  46. public Dame(){
  47.      this.dran = true;
  48.      this.anzSteineSchwarz = 12;
  49.      this.anzSteineWei├č = 12;
  50.      this.klickzaehler = 0;
  51.      this.nixMoeglich = 0;
  52.  
  53.      for (int i = 0; i < 8; i++){   //Feld "EinNullen"
  54.          for (int j = 0; j < 8; j++){
  55.              this.feld[i][j] = 10;
  56.          }
  57.      }
  58.  
  59.      for (int i=0; i<8;i++){
  60.          for(int j=0;j<8;j++){
  61.              if ((i%2==1) ^ (j%2==1)){
  62.                  if (j<3) this.feld[i][j]=1;
  63.                  else if (j>=5)  this.feld[i][j] = 3;
  64.              }
  65.          }
  66.      }
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top