Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package view;
- import javafx.application.Application;
- import javafx.scene.Scene;
- import javafx.scene.control.Label;
- import javafx.scene.image.Image;
- import javafx.scene.image.ImageView;
- import javafx.scene.layout.BorderPane;
- import javafx.scene.layout.Pane;
- import javafx.scene.layout.StackPane;
- import javafx.scene.layout.VBox;
- import javafx.stage.Stage;
- import view.panes.*;
- import view.panes.event.ChangePaneEvent;
- import view.util.TransitionUtils;
- public class Othello extends Application {
- private static int WIDTH = 1250;
- private static int HEIGHT = 800;
- // Stage
- private Stage stage;
- // Main scene
- private Scene scene;
- // Home
- private Pane home;
- private Pane play;
- private Pane rules;
- // Game
- private Pane game;
- public static void main(String[] args) {
- launch(args);
- }
- private void createModel() {
- // new model
- }
- private void createView() {
- stage.setTitle("Othello");
- home = new HomePane();
- play = new PlayPane();
- rules = new RulesPane();
- game = new GamePane();
- }
- private void placeComponents() {
- BorderPane p = new BorderPane();
- {
- StackPane stack = new StackPane();
- {
- stack.getChildren().addAll(home, play, rules);
- stack.setMinWidth(800);
- }
- p.setCenter(stack);
- VBox vbox = new VBox();
- {
- Label l1 = new Label("Projet");
- Label l2 = new Label("Théorie des jeux (2019)");
- Label l3 = new Label("Développeurs");
- Label l4 = new Label("LE CREURER Benjamin");
- Label l5 = new Label("LEBIDOIS Yohann");
- Label l6 = new Label("LEROUX Romuald");
- Label l7 = new Label("MAKHLOUF Bilal");
- Label nbsp = new Label();
- ImageView iv = new ImageView();
- iv.setImage(new Image("/img/logo_univ.png"));
- vbox.getChildren().add(l1);
- vbox.getChildren().add(l2);
- vbox.getChildren().add(l3);
- vbox.getChildren().add(l4);
- vbox.getChildren().add(l5);
- vbox.getChildren().add(l6);
- vbox.getChildren().add(l7);
- vbox.getChildren().add(nbsp);
- vbox.getChildren().add(iv);
- // Classe CSS
- vbox.getStyleClass().add("vbox");
- l1.getStyleClass().add("lbl-title");
- l3.getStyleClass().add("lbl-title");
- l2.getStyleClass().add("lbl-sub");
- l4.getStyleClass().add("lbl-sub");
- l5.getStyleClass().add("lbl-sub");
- l6.getStyleClass().add("lbl-sub");
- l7.getStyleClass().add("lbl-sub");
- nbsp.getStyleClass().add("nbsp-50");
- //vbox.setPrefWidth(400);
- }
- p.setRight(vbox);
- }
- scene = new Scene(p, WIDTH, HEIGHT);
- scene.getStylesheets().add("css/style.css");
- stage.setScene(scene);
- }
- private void createController() {
- home.addEventHandler(ChangePaneEvent.HOME_TO_PLAY, e -> TransitionUtils.fadeInOut(play, home));
- home.addEventHandler(ChangePaneEvent.HOME_TO_RULES, e -> TransitionUtils.fadeInOut(rules, home));
- play.addEventHandler(ChangePaneEvent.PLAY_TO_HOME, e -> TransitionUtils.fadeInOut(home, play));
- rules.addEventHandler(ChangePaneEvent.RULES_TO_HOME, e -> TransitionUtils.fadeInOut(home, rules));
- play.addEventHandler(ChangePaneEvent.PLAY_TO_GAME, e -> {
- scene.setRoot(game);
- });
- }
- @Override
- public void start(Stage primaryStage) {
- stage = primaryStage;
- createModel();
- createView();
- placeComponents();
- createController();
- stage.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement