parent
90503842ed
commit
7cabe1fc32
@ -1,26 +0,0 @@
|
||||
package FXML;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Spinner;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
|
||||
public class VueJeu {
|
||||
@FXML
|
||||
private GridPane map = new GridPane();
|
||||
|
||||
@FXML
|
||||
private Spinner rowGame = new Spinner();
|
||||
|
||||
@FXML
|
||||
private Spinner colGame = new Spinner();
|
||||
|
||||
public void initialize() {
|
||||
for(int i=0; i<50; ++i){
|
||||
for(int j=0; j<50; ++j) {
|
||||
map.add(new Rectangle(10, 10, Paint.valueOf("#AABBCC")), i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package views;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.control.cell.TextFieldListCell;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
|
||||
public class VueJeu {
|
||||
@FXML
|
||||
private GridPane map;
|
||||
|
||||
@FXML
|
||||
private TextField rowGame;
|
||||
|
||||
@FXML
|
||||
private TextField colGame;
|
||||
|
||||
@FXML
|
||||
private Button createGrid;
|
||||
|
||||
@FXML
|
||||
private Label nbRowGame;
|
||||
|
||||
@FXML
|
||||
private Label nbColGame;
|
||||
|
||||
private void createGrid() {
|
||||
for(int i=0; i < Integer.parseInt(rowGame.getText()); ++i){
|
||||
for(int j=0; j < Integer.parseInt(colGame.getText()); ++j) {
|
||||
map.add(new Rectangle(10, 10, Paint.valueOf("#AABBCC")), i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
createGrid();
|
||||
|
||||
nbColGame.setText(colGame.getText());
|
||||
nbRowGame.setText(rowGame.getText());
|
||||
}
|
||||
}
|
Loading…
Reference in new issue