Untitled
unknown
plain_text
a month ago
2.2 kB
3
Indexable
@Override public void start(Stage stage) { Board board = new Board(400, 400); //BoardView view = new BoardView(board); HomeView view = new HomeView(); HomeView homeView = new HomeView(); Button rollDiceBtn = new Button("Roll Dice"); //new BoardPresenter(board, view, rollDiceBtn); new HomePresenter(homeView, homeView.getPlayButton(), homeView.getRulesButton(),homeView.getHighscoresButton(), homeView.getHelpButton(), homeView.getAboutButton(), board); StackPane root = new StackPane(view, rollDiceBtn); StackPane.setAlignment(rollDiceBtn, Pos.BOTTOM_CENTER); Scene scene = new Scene(homeView, 800, 800); stage.setMaximized(true); stage.setTitle("Trivial Pursuit"); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } } package be.kdg.trivialpursuit.presenters; import be.kdg.trivialpursuit.models.Board; import be.kdg.trivialpursuit.views.BoardView; import be.kdg.trivialpursuit.views.HomeView; import javafx.scene.control.Button; public class HomePresenter implements Presenter { private final HomeView view; private final Button startButton; private final Button rulesButton; private final Button highScoresButton; private final Button helpButton; private final Button aboutButton; private final Board board; public HomePresenter(HomeView view, Button startButton, Button rulesButton, Button highScoresButton, Button helpButton, Button aboutButton, Board board) { this.view = view; this.startButton = startButton; this.rulesButton = rulesButton; this.highScoresButton = highScoresButton; this.helpButton = helpButton; this.aboutButton = aboutButton; this.board = board; addEventHandlers(); updateView(); } @Override public void addEventHandlers() { startButton.setOnAction(e -> { BoardView boardView = new BoardView(board); view.getScene().setRoot(boardView); }); } @Override public void updateView() { } @Override public void addWindowEventHandlers() { } }
Editor is loading...
Leave a Comment