private void configuraStileToolbar() {
   save.setId("tbb-save");
   this.setId("toolBar");
   this.setMinHeight(55);
   this.setMaxHeight(55);
   save.setMinSize(60, 45);
   save.getStyleClass().add("toolBar-button");
   labelTitolo.getStyleClass().add("titolo");
 }
示例#2
0
  public void loadEditorButtons(Group root) {
    Group group = new Group();
    group.setLayoutX(730);
    group.setLayoutY(600);

    Button b1 = new Button("save");
    b1.setId("save");
    b1.setOnAction(new EditorSaveToDBListener());

    Button b2 = new Button("new Map");
    b2.setId("showStage");

    EditorNewMapListener enml = new EditorNewMapListener();
    enml.setloadMapObjekt(this);
    b2.setOnAction(enml);
    b2.setLayoutY(25);

    group.getChildren().add(b1);
    group.getChildren().add(b2);

    root.getChildren().add(group);
  }
  public void loadCatalogs() {
    Button button;
    Catalog catalog;
    List<Item> items =
        ((CatalogCollection) (new CatalogModel()).getCollection()).loadByLibraryId(libraryId);
    int i = 1;

    for (Item item : items) {
      catalog = (Catalog) item;
      button = new Button(catalog.getName());
      int catalogId = catalog.getId();
      button.setId(String.valueOf(catalogId));
      button.getStyleClass().add("cake");
      button.setOnAction(
          (ActionEvent event) -> {
            try {
              Scene sceneCurrent = btnBack.getScene();
              Stage stage = (Stage) sceneCurrent.getWindow();

              FXMLLoader fxmlLoader =
                  new FXMLLoader(getClass().getResource("/view/template/book/BookList.fxml"));
              Parent sceneNew = fxmlLoader.load();

              BookListController controller = fxmlLoader.<BookListController>getController();
              controller.setCatalogId(catalogId);
              controller.setLibraryId(libraryId);
              controller.prepareData();

              stage.setScene(
                  new Scene(sceneNew, sceneCurrent.getWidth(), sceneCurrent.getHeight()));
            } catch (IOException e) {
              logger.log(Level.SEVERE, "Error configuring catalog buttons", e);
            }
          });
      catalogContainer.add(button, i++, 1);
    }
  }
示例#4
0
  /**
   * Das GUI besteht aus zwei wesentlichen Komponenten, einer GridPane namens entryArea und einem
   * TextAreaHandler, beide sind in eine BorderPane eingebettet.
   */
  @Override
  protected Scene create_GUI() {

    // ServiceLocator und Translator werden gesetzt.
    ServiceLocator sl = ServiceLocator.getServiceLocator();
    Translator t = sl.getTranslator();

    // Die MenuBar enthält die Sprachauswahl
    MenuBar menuBar = new MenuBar();
    menuFile = new Menu(t.getString("program.menu.file"));
    menuFileLanguage = new Menu(t.getString("program.menu.file.language"));
    menuFile.getItems().add(menuFileLanguage);

    for (Locale locale : sl.getLocales()) {
      MenuItem language = new MenuItem(locale.getLanguage());
      menuFileLanguage.getItems().add(language);
      language.setOnAction(
          event -> {
            sl.setTranslator(new Translator(locale.getLanguage()));
            updateTexts();
          });
    }

    BorderPane root = new BorderPane();
    root.setPrefSize(409, 219);

    menuBar.getMenus().addAll(menuFile);
    root.setTop(menuBar);

    /**
     * ______________________________________________________________________________________________
     * START OF GRIDPANE !!! ENTRYAREA !!!
     */

    // Serverentry Area
    GridPane entryArea = new GridPane();
    entryArea.setAlignment(Pos.CENTER);
    root.setCenter(entryArea);

    Label lblIP = new Label();
    lblIP.setText("IP: ");
    ;
    lblIP.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblIP, 0, 0);
    GridPane.setMargin(lblIP, new Insets(5, 5, 0, 50));

    Label lblPort = new Label();
    lblPort.setText("Port: ");
    lblPort.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblPort, 0, 1);
    GridPane.setMargin(lblPort, new Insets(5, 5, 0, 50));

    lblHostName = new Label();
    lblHostName.setAlignment(Pos.CENTER_LEFT);
    lblHostName.setId("lblHostName");
    entryArea.add(lblHostName, 0, 2);
    GridPane.setMargin(lblHostName, new Insets(5, 5, 0, 50));

    tfIP = new TextField();
    tfIP.setId("tfIP");
    tfIP.setEditable(false);
    entryArea.add(tfIP, 1, 0);
    GridPane.setMargin(tfIP, new Insets(5, 5, 0, 0));

    tfPort = new TextField();
    tfPort.setId("tfPort");
    tfPort.setText("14000");
    tfPort.setPromptText("Bitte Portnummer eingeben.");
    entryArea.add(tfPort, 1, 1);
    GridPane.setMargin(tfPort, new Insets(5, 5, 0, 0));

    btnStart = new Button();
    btnStart.setId("btnStart");
    btnStart.setText(t.getString("button.start"));
    entryArea.add(btnStart, 2, 0);
    GridPane.setMargin(btnStart, new Insets(5, 5, 0, 50));

    btnClose = new Button();
    btnClose.setId("btnClose");
    btnClose.setText(t.getString("button.close"));
    entryArea.add(btnClose, 2, 1);
    GridPane.setMargin(btnClose, new Insets(5, 5, 0, 50));

    /**
     * ______________________________________________________________________________________________
     * START OF !!! TEXTAREAHANDLER !!!
     */
    textAreaHandler = new TextAreaHandler();
    taLogger = textAreaHandler.getTextArea();
    taLogger.setId("taLogger");
    taLogger.setEditable(false);
    root.setBottom(taLogger);

    Scene scene = new Scene(root);

    return scene;
  }
  private void buildUserCredentials(ActionEvent event) {

    // System.out.println("Valore di numreserved " + Integer.toString(numreserved));
    GridPane gp = ((GridPane) ((Button) event.getSource()).getParent());
    int numreserved = ((Spinner<Integer>) gp.getChildren().get(0)).getValue();
    gridCredential.getChildren().clear();

    /*
    int j =0;
    for(int i=0; i<numreserved*3;i = i + 3){

        Label nameL = new Label("Nome partecipante");
        Label surnameL = new Label("Cognome partecipante");
        Label birthdayL = new Label("Data Nascita");

        TextField txname = new TextField();
        TextField txsurname = new TextField();
        TextField txbirthday = new TextField();

        gridCredential.add(nameL,j,i);
        gridCredential.add(txname,j+1,i);
        gridCredential.add(surnameL,j,i+1);
        gridCredential.add(txsurname,j+1,i+1);
        gridCredential.add(birthdayL,j,i+2);
        gridCredential.add(txbirthday,j+1,i+2);
        gridCredential.setVgap(20);
        gridCredential.setHgap(3);
    }*/

    for (int i = 0; i < numreserved; i++) {

      GridPane grd = new GridPane();

      Label lblL = new Label("Inserire credenziali partecipante");
      Label nameL = new Label("Nome partecipante");
      Label surnameL = new Label("Cognome partecipante");
      Label birthdayL = new Label("Data Nascita");

      TextField txname = new TextField();
      TextField txsurname = new TextField();
      TextField txbirthday = new TextField();

      grd.add(lblL, 0, 0);
      grd.addRow(1);
      grd.add(nameL, 0, 2);
      grd.add(txname, 1, 2);
      grd.add(surnameL, 0, 3);
      grd.add(txsurname, 1, 3);
      grd.add(birthdayL, 0, 4);
      grd.add(txbirthday, 1, 4);
      grd.addRow(5);
      grd.setVgap(10);
      grd.setHgap(3);

      gridCredential.add(grd, 0, i);
    }

    Button okButton = new Button("OK");
    gridCredential.add(okButton, 0, numreserved);

    okButton.setId(((RadioButton) tg.getSelectedToggle()).getId());
    okButton.setOnAction(prenotaViaggioControl::reserveTrip);

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setContent(gridCredential);

    gp.add(scrollPane, 0, 1);

    gpMediator.send(gridCredential, this);
  }
示例#6
0
  @Override
  public void start(Stage theStage) {
    this.tStage = theStage;
    theStage.setTitle("Ball of Duty");
    theStage.setHeight(WINDOW_START_HEIGHT);
    theStage.setWidth(WINDOW_START_WIDTH);
    theStage.centerOnScreen();
    theStage.setResizable(false);
    theStage.setOnCloseRequest(
        new EventHandler<WindowEvent>() {
          public void handle(WindowEvent we) {
            gameManager.quitGame();
            System.exit(0);
          }
        });

    BorderPane startMenuRoot = new BorderPane();
    startMenu = new Scene(startMenuRoot);

    gameBox = new BorderPane();
    Scene gameScene = new Scene(gameBox);

    BorderPane createAccountRoot = new BorderPane();
    BorderPane lohInRoot = new BorderPane();

    theStage.setScene(startMenu);

    gameManager = new GameClient(getRelativeSceneLocation(theStage));

    scale = new Scale();
    scale.xProperty().bind(gameScene.widthProperty().divide(WINDOW_START_WIDTH));
    scale.yProperty().bind(gameScene.heightProperty().divide(WINDOW_START_HEIGHT));
    scale.setPivotX(0);
    scale.setPivotY(0);
    // gameBox.getTransforms().add(scale);
    // gameBox.setBackground(null);
    // TODO scaling

    theStage
        .heightProperty()
        .addListener(
            e -> {
              gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); // This
              // only
              // happens
              // once
              // for
              // some
              // reason.
            });
    theStage
        .widthProperty()
        .addListener(
            e -> {
              gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage));
            });
    theStage
        .xProperty()
        .addListener(
            e -> {
              gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage));
            });
    theStage
        .yProperty()
        .addListener(
            e -> {
              gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage));
            });
    gameScene
        .xProperty()
        .addListener(
            e -> {
              gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage));
            });
    gameScene
        .yProperty()
        .addListener(
            e -> {
              gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage));
            });
    Image image = new Image("images/frontpage.png");
    BackgroundSize backgroundSize = new BackgroundSize(100, 100, true, true, true, false);
    // new BackgroundImage(image, repeatX, repeatY, position, size)
    BackgroundImage backgroundImage =
        new BackgroundImage(
            image,
            BackgroundRepeat.REPEAT,
            BackgroundRepeat.NO_REPEAT,
            BackgroundPosition.CENTER,
            backgroundSize);
    // new Background(images...)
    Background background = new Background(backgroundImage);
    startMenuRoot.setBackground(background);

    RadioButton chooseBlaster = new RadioButton("Blaster");
    RadioButton chooseRoller = new RadioButton("Roller");
    RadioButton chooseHeavy = new RadioButton("Heavy");

    final ToggleGroup specializationGroup = new ToggleGroup();

    chooseBlaster.setToggleGroup(specializationGroup);
    chooseRoller.setToggleGroup(specializationGroup);
    chooseHeavy.setToggleGroup(specializationGroup);

    chooseBlaster.setSelected(true);

    HBox specializationBox = new HBox();
    specializationBox.setSpacing(9);
    specializationBox.getChildren().add(chooseBlaster);
    specializationBox.getChildren().add(chooseRoller);
    specializationBox.getChildren().add(chooseHeavy);

    Label lblNickname = new Label("Nickname:");
    TextField tfNickname = new TextField();
    Button loginStart = new Button("Log in");
    Button createStart = new Button("Create Account");
    theStage.getIcons().add(new Image("images/ball_red.png"));
    VBox mainButtonBox = new VBox();
    mainButtonBox.setSpacing(5);
    Button joinBtn = new Button("Join game");

    Button viewLB = new Button("Leaderboard");
    viewLB.setPrefSize(150, 50);
    viewLB.setId("viewLB");
    viewLB.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");

    BorderPane lbBorder = new BorderPane();
    VBox lbBox = new VBox();
    Scene lbScene = new Scene(lbBorder);

    Button lbBack = new Button("Start menu");
    lbBox.getChildren().add(lbBack);
    lbBorder.setLeft(lbBox);
    lbBack.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");

    Label topText = new Label("Only shows scores higher than 100!");
    topText.setStyle("-fx-font-size: 20pt;-fx-font-family: Segoe UI Semibold;");

    viewLB.setOnAction(
        ActionEvent -> {
          HighscoreLeaderboard hBoard = gameManager.getHighscoreLeaderboard();
          hBoard.setFocusTraversable(false);
          lbBorder.setCenter(hBoard);
          if (gameManager.getPlayer() != null) {
            Player client = gameManager.getPlayer();
            Label you =
                new Label(
                    "YOU:    "
                        + client.getNickname()
                        + " ["
                        + client.getId()
                        + "]    | Score: "
                        + client.getHighscore());

            you.setStyle("-fx-font-size: 15pt;-fx-font-family: Segoe UI Semibold;");
            lbBorder.setBottom(you);
          }

          BorderPane.setMargin(hBoard, new Insets(12, 12, 12, 12));

          lbBorder.setTop(topText);
          theStage.setScene(lbScene);

          lbBack.setOnAction(
              ActionEvent1 -> {
                theStage.setScene(startMenu);
                startMenuRoot.setLeft(mainButtonBox);

                BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150));
              });
        });

    joinBtn.setPrefSize(150, 50);
    tfNickname.setPrefSize(150, 20);
    joinBtn.setId("joinBtn");
    joinBtn.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");
    lblNickname.setId("lblNickname");
    lblNickname.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");
    createStart.setId("CreateStart");
    createStart.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");
    loginStart.setId("loginStart");
    loginStart.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");

    joinBtn.setOnAction(
        ActionEvent -> {
          Specializations spec;
          if (chooseRoller.isSelected()) {
            spec = Specializations.ROLLER;
          } else if (chooseHeavy.isSelected()) {
            spec = Specializations.HEAVY;
          } else // Blaster is default, if something goes wrong with radio
          // buttons
          {
            spec = Specializations.BLASTER;
          }

          theStage.setScene(gameScene);
          gameManager.joinAsGuest(gameBox, tfNickname.getText(), spec);
          gameManager.getMap().addObserver(this);
          gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage));
          gameBox.requestFocus();
        });
    tfNickname.setOnAction(
        ActionEvent -> {
          Specializations spec;
          if (chooseRoller.isSelected()) {
            spec = Specializations.ROLLER;
          } else if (chooseHeavy.isSelected()) {
            spec = Specializations.HEAVY;
          } else // Blaster is default, if something goes wrong with radio
          // buttons
          {
            spec = Specializations.BLASTER;
          }
          theStage.setScene(gameScene);
          gameManager.joinAsGuest(gameBox, tfNickname.getText(), spec);
          gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage));
          gameBox.requestFocus();
        });

    mainButtonBox.getChildren().add(lblNickname);
    mainButtonBox.getChildren().add(tfNickname);
    mainButtonBox.getChildren().add(specializationBox);
    mainButtonBox.getChildren().add(joinBtn);
    mainButtonBox.getChildren().add(loginStart);
    mainButtonBox.getChildren().add(createStart);
    mainButtonBox.getChildren().add(viewLB);
    startMenuRoot.setLeft(mainButtonBox);

    createStart.setOnAction(
        ActionEvent -> {
          VBox createAccountButtonBox = new VBox();
          Label lblNickname2 = new Label("Nickname:");
          TextField tfNickname2 = new TextField();
          Label lblUserName = new Label("Name:");
          TextField tfUserName = new TextField();
          Label lblPassword = new Label("Password:"******"Repeat password:"******"Create account");
          Button back = new Button("Start menu");

          createBtn.setId("join-yyyyy");
          createBtn.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");
          lblUserName.setId("join-game");
          lblUserName.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");
          lblPassword.setId("join-game");
          lblPassword.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");
          lblPassword2.setId("join-game");
          lblPassword2.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");
          back.setId("join-game");
          back.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");

          createAccountButtonBox.getChildren().add(lblNickname2);
          createAccountButtonBox.getChildren().add(tfNickname2);
          createAccountButtonBox.getChildren().add(lblUserName);
          createAccountButtonBox.getChildren().add(tfUserName);
          createAccountButtonBox.getChildren().add(lblPassword);
          createAccountButtonBox.getChildren().add(pf);
          createAccountButtonBox.getChildren().add(lblPassword2);
          createAccountButtonBox.getChildren().add(pf2);
          createAccountButtonBox.getChildren().add(createBtn);
          createAccountButtonBox.getChildren().add(back);

          startMenuRoot.setLeft(createAccountButtonBox);
          BorderPane.setMargin(createAccountButtonBox, new Insets(350, 0, 0, 150));

          createBtn.setOnAction(
              ActionEvent1 -> {
                gameManager.createAccount(
                    tfUserName.getText(),
                    tfNickname2.getText(),
                    pf.getText().toCharArray(),
                    pf2.getText().toCharArray());
                startMenuRoot.setLeft(mainButtonBox);
                BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150));
              });

          back.setOnAction(
              ActionEvent1 -> {
                startMenuRoot.setLeft(mainButtonBox);
                BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150));
              });
        });

    loginStart.setOnAction(
        ActionEvent -> {
          VBox loginButtonBox = new VBox();
          Button logInBtn = new Button("Log in");
          Label lblUserName2 = new Label("Name:");
          TextField tfUserName2 = new TextField();
          Label lblPassword2 = new Label("Password:"******"Start Menu");

          logInBtn.setId("join-game");
          logInBtn.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");
          back2.setId("join-game");
          back2.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;");

          loginButtonBox.getChildren().add(lblUserName2);
          loginButtonBox.getChildren().add(tfUserName2);
          loginButtonBox.getChildren().add(lblPassword2);
          loginButtonBox.getChildren().add(pf3);
          loginButtonBox.getChildren().add(logInBtn);
          loginButtonBox.getChildren().add(back2);

          startMenuRoot.setLeft(loginButtonBox);
          BorderPane.setMargin(loginButtonBox, new Insets(350, 0, 0, 150));

          logInBtn.setOnAction(
              ActionEvent1 -> {
                // TODO login
              });

          back2.setOnAction(
              ActionEvent1 -> {
                startMenuRoot.setLeft(mainButtonBox);
                BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150));
              });
        });

    BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150));

    Button quitBtn = new Button("Quit game");
    quitBtn.setPrefSize(80, 40);
    quitBtn.setId("quit-game");

    quitBtn.setOnAction(
        ActionEvent -> {
          gameManager.quitGame();
          theStage.setScene(startMenu);
        });

    canvas = new Canvas(CANVAS_START_WIDTH, CANVAS_START_HEIGHT);
    gameBox.setCenter(canvas);
    BorderPane.setAlignment(canvas, Pos.TOP_LEFT);

    gameBox.setBottom(quitBtn);
    BorderPane.setAlignment(quitBtn, Pos.TOP_LEFT);
    theStage.show();
  }
  @Test
  public void basicMessageUpdateTest() throws InterruptedException, ExecutionException {
    CountDownLatch latch1 = new CountDownLatch(1);
    CountDownLatch latch2 = new CountDownLatch(1);
    CountDownLatch latch3 = new CountDownLatch(1);
    CountDownLatch latch4 = new CountDownLatch(1);
    CountDownLatch latch5 = new CountDownLatch(1);
    CountDownLatch latch6 = new CountDownLatch(1);
    final FXWorker<?> handler = FXWorker.instance();

    Label messageLabel = new Label("---");
    messageLabel.setId("messageLabel");
    messageLabel.textProperty().bind(handler.messageProperty());
    FXWorker.invokeOnFXThreadAndWait(() -> mainPane.getChildren().add(messageLabel));

    handler
        .supplyOnExecutorThread(
            () -> {
              try {
                System.out.println("-- THREAD SUPPLY POOL 1: " + Thread.currentThread());
                TimeUnit.MILLISECONDS.sleep(2000);

              } catch (InterruptedException e) {
                e.printStackTrace();
              }
              handler.updateMessage("pass1");
              latch1.countDown();

              return "abc";
            })
        .functionOnExecutorThread(
            (input) -> {
              try {
                System.out.println(
                    "-- THREAD functionOnExecutorThread POOL 1: " + Thread.currentThread());
                TimeUnit.MILLISECONDS.sleep(2000);

              } catch (InterruptedException e) {
                e.printStackTrace();
              }
              handler.updateMessage("pass2");
              latch2.countDown();
              return input;
            })
        .functionOnFXThread(
            i -> {
              System.out.println("-- THREAD functionOnFXThread FX1: " + Thread.currentThread());
              System.out.println("----" + i);
              Button b1 = new Button(i);
              b1.setId(i);
              mainPane.getChildren().add(b1);
              handler.updateMessage("pass3");
              latch3.countDown();
              return i;
            })
        .consumeOnFXThread(
            (value) -> {
              System.out.println("-- THREAD consume FX1: " + Thread.currentThread());
              System.out.println("----" + value);
              Button b1 = new Button(value + 1);
              b1.setId(value + 1);
              mainPane.getChildren().add(b1);
              handler.updateMessage("pass4");
              latch4.countDown();
            })
        .supplyOnFXThread(
            () -> {
              System.out.println("-- THREAD supply FX2: " + Thread.currentThread());
              Button ok = new Button("ok");
              ok.setId("ok");
              handler.updateMessage("pass5");
              latch5.countDown();
              return ok;
            })
        .execute(
            (cc) -> {
              mainPane.getChildren().add(cc);
              System.out.println("STOP");
              handler.updateMessage("pass6");
              latch6.countDown();
            });
    latch1.await();

    NodeQuery message1 = lookup("#messageLabel");
    checkMessage(message1, "pass1", "stage1: ");

    latch2.await();
    NodeQuery message2 = lookup("#messageLabel");
    checkMessage(message2, "pass2", "stage2: ");

    latch3.await();
    NodeQuery message3 = lookup("#messageLabel");
    checkMessage(message3, "pass3", "stage3: ");

    latch4.await();
    NodeQuery message4 = lookup("#messageLabel");
    checkMessage(message4, "pass4", "stage4: ");

    latch5.await();
    NodeQuery message5 = lookup("#messageLabel");
    checkMessage(message5, "pass5", "stage5: ");

    latch6.await();
    NodeQuery message6 = lookup("#messageLabel");
    checkMessage(message6, "pass6", "stage6: ");

    NodeQuery button = lookup("#ok");
    Assert.assertTrue(button.tryQueryFirst().isPresent());
  }
  public BoardView(int noPlayers, final Stage primaryStage) {

    window = primaryStage;
    window.setTitle("Quoridor");
    window.setMaxHeight(1280);
    window.setMaxWidth(1280);
    window.setResizable(false);

    BorderPane border = new BorderPane();

    infoPane = new FlowPane();
    infoPane.setPadding(new Insets(10));
    infoPane.setHgap(40);
    infoPane.setVgap(10);
    infoPane.setOrientation(Orientation.HORIZONTAL);

    bottomPane = new HBox();
    bottomPane.setSpacing(345);

    gameGrid = new GridPane();
    gameGrid.setPadding(new Insets(4));
    gameGrid.setId("gamegrid");

    border.setTop(infoPane);
    border.setCenter(gameGrid);

    playerPositionButtons = new PlayerPositionButton[9][9];
    wallPositionButtons = new WallPositionButton[9][8];
    horizontalWalls = new Pane[9][9];
    verticalWalls = new Pane[9][9];

    column = 0;
    row = 0;

    chooseVertical = new Button();
    chooseVertical.setPrefSize(100, 100);
    chooseVertical.setId("vWallBtn");

    Button home = new Button();
    home.setPrefSize(100, 100);
    home.setId("home");
    home.setOnAction(e -> confirmBox());

    bottomPane.getChildren().addAll(chooseVertical, home);

    border.setBottom(bottomPane);
    border.setMargin(bottomPane, new Insets(40, 40, 20, 20));

    for (int y = 0; y < 8; y++) {
      createMoveLine(y);
      createWallLine(y);
    }

    createMoveLine(8);

    main = new Scene(border, 600, 768);
    main.getStylesheets().add("gameplay/viewJFX/" + stylesheet);
    buildPlayerLabels(noPlayers);
    window.setScene(main);
    window.show();
  }
示例#9
0
 /** @param id - Id for the button */
 public void setId(String id) {
   button.setId(id);
 }
  /** Constructs the profile grid pane */
  private ProfileSettings() {
    // Setting the style sheet
    this.getStylesheets()
        .add(this.getClass().getResource("css/profile_settings.css").toExternalForm());
    this.getStyleClass().add("grid");

    // Library Settings
    musicLibrarySettings_Label = new Label("Music Library");
    musicLibrarySettings_Label.setId("LabelBig");

    musicLibraryPath_Label = new Label("Path to Library:");
    musicLibraryPath_Label.setId("LabelSmall");
    orderingMode_Label = new Label("Ordering Mode:");
    musicLibraryPath = new TextField("");
    musicLibraryPath.setEditable(false);

    orderingMode_Label = new Label("Ordering Mode");
    orderingMode_Label.setId("LabelSmall");
    orderingMode = new ChoiceBox<String>();
    orderingMode.setItems(FXCollections.observableArrayList(AAA, AA, GAA));

    chooseDirToMusicLibrary = new Button();
    chooseDirToMusicLibrary.setId("OpenFolderButton");
    chooseDirToMusicLibrary.setGraphic(
        new ImageView(PropertiesUtils.getProperty(IconProperties.OPEN_FOLDER_IMPORT)));
    chooseDirToMusicLibrary.setOnAction(getButtonSetLibraryEventHandler());

    CenterGridPane.setConstraints(musicLibrarySettings_Label, 0, 0, 3, 1);
    CenterGridPane.setConstraints(musicLibraryPath_Label, 0, 1, 1, 1);
    CenterGridPane.setConstraints(musicLibraryPath, 1, 1, 1, 1);
    CenterGridPane.setConstraints(chooseDirToMusicLibrary, 2, 1, 1, 1);
    CenterGridPane.setConstraints(orderingMode_Label, 0, 2, 1, 1);
    CenterGridPane.setConstraints(orderingMode, 1, 2, 3, 1);

    // Import Settings
    importSettings_Label = new Label("Import Settings");
    importSettings_Label.setId("LabelBig");
    keepFiles_Label = new Label("Keep original files:");
    keepFiles_Label.setId("LabelSmall");
    keepFiles = new RadioButton();

    justTagFiles_Label = new Label("Just tag files:");
    justTagFiles_Label.setId("LabelSmall");
    justTagFiles = new RadioButton();

    CenterGridPane.setConstraints(importSettings_Label, 0, 4, 3, 1);
    CenterGridPane.setConstraints(keepFiles_Label, 0, 5, 1, 1);
    CenterGridPane.setConstraints(keepFiles, 1, 5, 1, 1);
    CenterGridPane.setConstraints(justTagFiles_Label, 0, 6, 1, 1);
    CenterGridPane.setConstraints(justTagFiles, 1, 6, 1, 1);

    // Playlist export settings
    playlistSettings_Label = new Label("Playlist Export Settings");
    playlistSettings_Label.setId("LabelBig");

    playListExport_Label = new Label("Playlist Export");
    playListExport_Label.setId("LabelSmall");
    playListExport = new RadioButton();

    playListName_Label = new Label("Playlist-Name:");
    playListName_Label.setId("LabelSmall");
    playListName = new TextField();

    playListExportPath_Label = new Label("Export Directory");
    playListExportPath_Label.setId("LabelSmall");
    playListExportPath = new TextField("");
    playListExportPath.setEditable(false);
    chooseDirToExportPlayList = new Button();
    chooseDirToExportPlayList.setId("OpenFolderButton");
    chooseDirToExportPlayList.setGraphic(
        new ImageView(PropertiesUtils.getProperty(IconProperties.OPEN_FOLDER_IMPORT)));
    chooseDirToExportPlayList.setOnAction(getButtonSetPlayListDirEventHandler());
    playListHeader = new Label("Playlist Header-Language");
    playListHeaderMode = new ChoiceBox<String>();
    playListHeaderMode.setItems(FXCollections.observableArrayList(germanHeader, englishHeader));

    CenterGridPane.setConstraints(playlistSettings_Label, 0, 8, 3, 1);
    CenterGridPane.setConstraints(playListExport_Label, 0, 9, 1, 1);
    CenterGridPane.setConstraints(playListExport, 1, 9, 1, 1);
    CenterGridPane.setConstraints(playListName_Label, 0, 10, 1, 1);
    CenterGridPane.setConstraints(playListName, 1, 10, 1, 1);
    CenterGridPane.setConstraints(playListExportPath_Label, 0, 11, 1, 1);
    CenterGridPane.setConstraints(playListExportPath, 1, 11, 1, 1);
    CenterGridPane.setConstraints(chooseDirToExportPlayList, 2, 11, 1, 1);
    CenterGridPane.setConstraints(playListHeader, 0, 12, 1, 1);
    CenterGridPane.setConstraints(playListHeaderMode, 1, 12, 1, 1);

    /** Restore and apply button */
    applyButton = new Button("Apply");
    applyButton.setOnAction(getButtonApplyEventHandler());

    restoreButton = new Button("Restore");
    restoreButton.setOnAction(getButtonRestoreEventHandler());

    CenterGridPane.setConstraints(restoreButton, 1, 13, 1, 1, HPos.RIGHT, VPos.CENTER);
    CenterGridPane.setConstraints(applyButton, 2, 13, 1, 1);

    this.getChildren()
        .addAll(
            musicLibrarySettings_Label,
            musicLibraryPath_Label,
            musicLibraryPath,
            chooseDirToMusicLibrary,
            orderingMode_Label,
            orderingMode,
            importSettings_Label,
            keepFiles_Label,
            keepFiles,
            justTagFiles_Label,
            justTagFiles,
            playlistSettings_Label,
            playListExport_Label,
            playListExport,
            playListName_Label,
            playListName,
            playListExportPath_Label,
            playListExportPath,
            chooseDirToExportPlayList,
            restoreButton,
            applyButton,
            playListHeader,
            playListHeaderMode);

    /** Reading the properties and adding them to the pane */
    readProperties();
  }
  public static void launchForm() {
    loginForm.setTitle("Welcome to GEEK - Log in or Register");
    loginForm.setResizable(false);
    loginForm
        .getIcons()
        .add(new Image(LoginForm.class.getResource("../style_elements/logo.png").toExternalForm()));

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);

    ImageView logo =
        new ImageView((LoginForm.class.getResource("../style_elements/logo.png").toExternalForm()));
    logo.setFitHeight(100);
    logo.setFitWidth(100);
    grid.setMargin(logo, new Insets(0, 0, 0, 72));
    grid.add(logo, 1, 1);

    username.setId("input_field");
    username.setPromptText("Username");
    username.setMinWidth(250);
    username.setFocusTraversable(false);
    grid.add(username, 1, 2);

    password.setId("input_field");
    password.setPromptText("Password");
    password.setMinWidth(250);
    password.setFocusTraversable(false);
    grid.add(password, 1, 3);

    sign_in_button.setId("sign_in_button");
    sign_in_button.setPrefHeight(35);
    sign_in_button.setCursor(Cursor.HAND);

    register_button.setId("register_button");
    register_button.setPrefHeight(35);
    register_button.setCursor(Cursor.HAND);

    HBox buttons = new HBox(10);
    buttons.setAlignment(Pos.CENTER);
    buttons.getChildren().addAll(sign_in_button, register_button);
    grid.add(buttons, 1, 4);

    HBox text = new HBox(3);
    text.setAlignment(Pos.CENTER);
    error_message_field.setFill(Color.WHITE);
    error_message_field.setId("error");
    text.getChildren().add(error_message_field);
    grid.add(text, 1, 6);

    setButtonsActions();

    Scene scene = new Scene(grid, 500, 500);
    scene
        .getStylesheets()
        .add(LoginForm.class.getResource("../style_elements/login_form.css").toExternalForm());
    loginForm.setScene(scene);
    loginForm.show();
    isOpen = true;
  }
  public static void createStartTownSaloonView() {
    GridPane gridPane = new GridPane();

    gridPane.setHgap(2);
    gridPane.setVgap(2);
    gridPane.setId("saloonGridBackground");

    Button backBtn = new Button("Back");
    backBtn.setId("mainScreenBtn");
    gridPane.add(backBtn, 0, 0);

    URL url =
        StartTownSaloonView.class.getClassLoader().getResource("resources/saloonPianoMusic.mp3");
    assert url != null;
    final Media media = new Media(url.toString());
    final MediaPlayer mediaPlayer = new MediaPlayer(media);
    mediaPlayer.setVolume(25);
    mediaPlayer.setCycleCount(99);
    mediaPlayer.play();

    Scene scene =
        new Scene(
            gridPane,
            Main.getPrimaryStage().getScene().getWidth(),
            Main.getPrimaryStage().getScene().getHeight());

    scene.getStylesheets().add("resources/main.css");

    ArrayList<Tooltip> tooltipArrayList = new ArrayList<>();

    AddKeyListenerToScene.addGeneralKeyListener(scene);
    /**
     * Need to add a bunch of collision detection rectangles for clicking on people and getting a
     * toolip to popup.
     */
    scene.setOnMouseClicked(
        event -> {
          double x = event.getX();
          double y = event.getY();
          for (Tooltip eraseTooltip : tooltipArrayList) {
            eraseTooltip.hide();
          }

          if (x >= 767.0 && x <= 814.0 && y >= 378.0 && y <= 461.0) {
            Tooltip bartender = new Tooltip("What can I get ya?");
            bartender.setId("startTownSaloonTooltip");
            bartender.show(
                gridPane, 776.0 + scene.getWindow().getX(), 407.0 + scene.getWindow().getY());
            tooltipArrayList.add(bartender);
          }
          if (x >= 687.0 && x <= 759.0 && y >= 387.0 && y <= 507.0) {
            Tooltip oldManAtTheBar =
                new Tooltip("Whiskey, Mmm Mmm Mmm down to my belly, yum yum yum...*hiccup*");
            oldManAtTheBar.setId("startTownSaloonTooltip");
            oldManAtTheBar.show(
                gridPane, 745.0 + scene.getWindow().getX(), 432.0 + scene.getWindow().getY());
            tooltipArrayList.add(oldManAtTheBar);
          }
          if (x >= 43.0 && x <= 102.0 && y >= 330.0 && y <= 545.0) {
            Tooltip banjoPlayerInBack = new Tooltip("Yoddle yoddleeeee yoddleeeeheeeehoooo...");
            banjoPlayerInBack.setId("startTownSaloonTooltip");
            banjoPlayerInBack.show(
                gridPane, 83.0 + scene.getWindow().getX(), 356.0 + scene.getWindow().getY());
            tooltipArrayList.add(banjoPlayerInBack);
          }
          if (x >= 606.0 && x <= 662.0 && y >= 383.0 && y <= 688.0) {
            Tooltip secretAlienTechHintDude =
                new Tooltip(
                    "I was out in the fields...staring\n"
                        + "at the sky when suddenly a huge blinding\n"
                        + "light shot up from the ground. Aliens man\n"
                        + "I hope they left something behind for me to\n"
                        + "find!");
            secretAlienTechHintDude.setId("startTownSaloonTooltip");
            secretAlienTechHintDude.show(
                gridPane, 645.0 + scene.getWindow().getX(), 428.0 + scene.getWindow().getY());
            tooltipArrayList.add(secretAlienTechHintDude);
          }
          if (x >= 923.0 && x <= 1029.0 && y >= 385.0 && y <= 752.0) {
            Tooltip guyHittingOnGirlOnRight = new Tooltip("Sup baby gurrllllll");
            guyHittingOnGirlOnRight.setId("startTownSaloonTooltip");
            guyHittingOnGirlOnRight.show(
                gridPane, 952.0 + scene.getWindow().getX(), 427.0 + scene.getWindow().getY());
            tooltipArrayList.add(guyHittingOnGirlOnRight);
          }

          /**
           * Set listeners for window drags. If user drags the window then hide all the tooltips or
           * they will stay where they are until user hides them with the other commands. Aesthetics
           * only really.
           */
          scene
              .getWindow()
              .xProperty()
              .addListener(
                  (observable, oldValue, newValue) -> {
                    for (Tooltip eraseTooltip : tooltipArrayList) {
                      eraseTooltip.hide();
                    }
                  });
          scene
              .getWindow()
              .yProperty()
              .addListener(
                  (observable, oldValue, newValue) -> {
                    for (Tooltip eraseTooltip : tooltipArrayList) {
                      eraseTooltip.hide();
                    }
                  });

          // System.out.println(event.getX());
          // System.out.println(event.getY());
        });

    backBtn.setOnAction(
        event -> {
          Main.getPrimaryStage().setScene(StartingTownView.getStartingTownView());
          mediaPlayer.stop();
          for (Tooltip eraseTooltip : tooltipArrayList) {
            eraseTooltip.hide();
            eraseTooltip = null;
          }
        });

    setStartSaloon(scene);
    Main.getPrimaryStage().setScene(scene);
  }
示例#13
0
  /** Done by Marco */
  public void searchForPubs() {
    pubLayout.getChildren().remove(noPub);
    int y = 1;
    int x = 1;
    searchName = searchNameInput.getText();
    searchStreet = searchStreetInput.getText();
    /** End of marco's work */

    /** Done by Ahmad */
    if (!searchAgeInput.getText().equals("")) {
      searchAge = Integer.valueOf(searchAgeInput.getText());
    } else searchAge = 100;

    pubs.getChildren().clear();

    /* Random pub search */

    randomPub = new Button("- Random Pub -");
    randomPub.setId("randomPub-button");
    randomPub.setMinWidth(230);
    randomPub.setMinHeight(100);
    Random random = new Random();
    randomPub.setOnAction(
        (event) -> {
          idOfButton(random.nextInt(PubDataAccessor.pubs.size()));
          primaryStage.setScene(pubPage);
          setPubScene();
        });

    randomPub.setAlignment(Pos.CENTER);
    pubs.getChildren().add(randomPub);

    GridPane.setRowIndex(randomPub, 1);
    GridPane.setColumnIndex(randomPub, 0);
    /** End of Ahmad's Work */

    /** Done by Shafiq & Antonino & Marco */
    for (Pub pub : PubDataAccessor.pubs) {
      if (searchEvent && pub.eventName.isEmpty()) {
        continue;
      }

      if (area_checker != 2 && pub.location_id != area) {
        continue;
      }

      if (pub.name != null
          && (pub.name.toLowerCase().contains(searchName.toLowerCase()))
          && pub.street != null
          && (pub.street.toLowerCase().contains(searchStreet.toLowerCase()))
          && pub.age <= searchAge
          && pub.nrStars >= numberOfStars
          && pub.hasStudentDiscount >= discount
          && pub.hasFee <= fee) {
        /** End of Shafiq & Antonini & Marco's Work */

        /** Done by Marco */
        pubButton = new Button("- " + pub.name + " -");
        pubButton.setId("pub-button");
        pubButton.setMinWidth(230);
        pubButton.setMinHeight(100);
        pubButton.setOnAction(
            (event) -> {
              idOfButton(pub.id);
              primaryStage.setScene(pubPage);
              setPubScene();
            });
        pubButton.setStyle("-fx-background-image: url(" + "\"" + pub.picture + "\"" + "); ");
        pubButton.setAlignment(Pos.CENTER);
        pubs.getChildren().add(pubButton);

        GridPane.setRowIndex(pubButton, y);
        GridPane.setColumnIndex(pubButton, x);

        x++;
      }
    }

    if (pubs.getChildren().size() == 0) {
      pubLayout.getChildren().add(noPub);
      noPub.setId("nopubs_message");
    }
    /* new elements */

    pubs.setHgap(30);
    /** End of Marco's work */
  }
示例#14
0
  /* ADMIN SCENE */
  public void start(Stage primaryStage) throws Exception {
    /** Done by Marco */
    primaryStage.setTitle("PubFinder");
    primaryStage.setResizable(false);
    PubDataAccessor.PubDataAccessor();

    /*Welcome scene*/
    WelcomeScene.welcomeScene();
    welcomeScene = WelcomeScene.welcomeScene;
    /*Welcome scene*/
    /** End of Marcos Work */
    /** Done by Shafiq and Anotnino */
    /* Admin add scene*/
    AdminAddScene.adminAddscene();
    adminAddScene = AdminAddScene.adminAddScene;
    /* Admin add scene*/

    /*Admin login scene*/
    AdminLoginScene.adminloginscene();
    adminLoginScene = AdminLoginScene.adminLoginScene;
    /*Admin login scene*/

    /*Admin choice scene*/
    AdminChoiceScene.adminchoicescene();
    adminChoiceScene = AdminChoiceScene.adminChoiceScene;
    /*Admin choice scene*/

    /* Admin Edit Scene*/
    adminEditScene = AdminEditScene.editScene;
    /* Admin Edit Scene*/
    /** End of Shafiq and Anotonino's Work */

    /*Pub button scene*/
    pubLayout = new StackPane();
    /** Done by Ahmad */
    searchNameInput = new TextField();
    searchNameInput.setId("search-field");
    searchNameInput.setPromptText("NAME");
    /** End of Ahmad's Work */
    searchStreetInput = new TextField();
    searchStreetInput.setId("search-field");
    searchStreetInput.setPromptText("STREET");
    searchAgeInput = new TextField();
    searchAgeInput.setId("search-field");
    searchAgeInput.setPromptText("AGE");
    /** Done by Aseel */
    CheckBox searchStudentDiscount = new CheckBox("DISCOUNTS");
    CheckBox searchBySpecialEvents = new CheckBox("EVENTS");
    CheckBox searchWithoutFees = new CheckBox("NO FEES");
    searchStudentDiscount.setId("check-search");
    searchBySpecialEvents.setId("check-search");
    searchWithoutFees.setId("check-search");
    ComboBox searchByRating =
        new ComboBox(
            FXCollections.observableArrayList(
                "\uF005",
                "\uF005\uF005",
                "\uF005\uF005\uF005",
                "\uF005\uF005\uF005\uF005",
                "\uF005\uF005\uF005\uF005\uF005"));
    searchByRating.setTooltip(new Tooltip("RATING"));
    searchByRating.setPromptText("RATING");
    searchByRating.setId("combo-search");
    ComboBox searchByArea =
        new ComboBox(
            FXCollections.observableArrayList(
                "All",
                "Avenyn",
                "Linné",
                "Haga",
                "Järntorget",
                "Magasinsgatan",
                "Vasastaden",
                "Gamlestaden",
                "Heden",
                "Masthugget",
                "Stigberget",
                "Other"));
    searchByArea.setTooltip(new Tooltip("AREA"));
    searchByArea.setPromptText("AREA");
    searchByArea.setId("combo-search");
    /** End of Aseel's Work */

    /** Done by Marco */
    pubLayout.setId("pubs");
    search = new Button("SEARCH");
    search.setId("button-search");
    GridPane inputGrid = new GridPane();
    inputGrid.setMaxHeight(100);
    inputGrid.setHgap(10);
    inputGrid.setVgap(10);
    inputGrid.setId("searchGrid");
    StackPane.setAlignment(inputGrid, Pos.TOP_LEFT);
    StackPane.setAlignment(search, Pos.TOP_RIGHT);
    /** End of Marco's Work */
    search.setOnAction(e -> searchForPubs());
    /** Done by Ahmad */
    searchNameInput.setOnKeyReleased(
        event1 -> {
          if (event1.getCode() == KeyCode.ENTER) {
            searchForPubs();
          }
        });
    /** End of Ahmad's Work */

    /** Done by Marco */
    searchStreetInput.setOnKeyReleased(
        event2 -> {
          if (event2.getCode() == KeyCode.ENTER) {
            searchForPubs();
          }
        });
    /** End of Marco's Work */

    /** Done by Ahmad */
    searchAgeInput.setOnKeyReleased(
        event3 -> {
          if (event3.getCode() == KeyCode.ENTER) {
            searchForPubs();
          }
        });
    /** End of Ahmad's Work */

    /** Done by Shafiq & Anotnino */
    searchStudentDiscount.setOnAction(
        event4 -> {
          if (searchStudentDiscount.isSelected()) {
            discount = 1;
          }
          if (!searchStudentDiscount.isSelected()) {
            discount = 0;
          }
        });

    searchWithoutFees.setOnAction(
        event5 -> {
          if (searchWithoutFees.isSelected()) {
            fee = 0;
          }
          if (!searchWithoutFees.isSelected()) {
            fee = 1;
          }
        });

    searchBySpecialEvents.setOnAction(
        event6 -> {
          if (searchBySpecialEvents.isSelected()) {

            searchEvent = true;
          }
          if (!searchBySpecialEvents.isSelected()) {
            searchEvent = false;
          }
        });

    searchByRating.setOnAction(
        event7 -> {
          if (searchByRating.getSelectionModel().isSelected(0)) {
            numberOfStars = 1;
          } else if (searchByRating.getSelectionModel().isSelected(1)) {
            numberOfStars = 2;
          } else if (searchByRating.getSelectionModel().isSelected(2)) {
            numberOfStars = 3;
          } else if (searchByRating.getSelectionModel().isSelected(3)) {
            numberOfStars = 4;
          } else if (searchByRating.getSelectionModel().isSelected(4)) {
            numberOfStars = 5;
          }
        });
    /** End of Shafiq and Anotino's Work */

    /** Done by Aseel and Antonino */
    searchByArea.setOnAction(
        event8 -> {
          if (searchByArea.getSelectionModel().isSelected(0)) {
            area_checker = 2;
          }
          if (searchByArea.getSelectionModel().isSelected(1)) {
            area = 0;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(2)) {
            area = 2;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(3)) {
            area = 3;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(4)) {
            area = 4;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(5)) {
            area = 5;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(6)) {
            area = 6;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(7)) {
            area = 7;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(8)) {
            area = 8;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(9)) {
            area = 9;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(10)) {
            area = 10;
            area_checker = 1;
          } else if (searchByArea.getSelectionModel().isSelected(11)) {
            area = 11;
            area_checker = 1;
          }
        });
    /** End of Aeel and Antonino's Work */

    /** Done by marco */
    ScrollPane pubScroll = new ScrollPane();
    pubScroll.setId("scroll");
    pubScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
    pubScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);

    pubs = new GridPane();
    pubScroll.setContent(pubs);
    pubs.setId("pub-grid");
    pubs.setAlignment(Pos.CENTER);
    pubLayout.getChildren().add(pubScroll);

    inputGrid.add(searchNameInput, 1, 1);
    inputGrid.add(searchStreetInput, 2, 1);
    inputGrid.add(searchAgeInput, 3, 1);

    inputGrid.add(searchByRating, 4, 1);
    inputGrid.add(searchByArea, 5, 1);
    inputGrid.add(searchStudentDiscount, 6, 1);
    inputGrid.add(searchBySpecialEvents, 7, 1);
    inputGrid.add(searchWithoutFees, 8, 1);

    pubLayout.getChildren().add(inputGrid);
    pubLayout.getChildren().add(search);
    noPub = new Label("No pubs found");
    searchForPubs();

    pubScene = new Scene(pubLayout, 1000, 600);
    pubScene.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm());
    /*Pub button scene*/

    /*Pub scene*/
    ScrollPane pubPageLayout = new ScrollPane();
    pubPageLayout.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    pubPageLayout.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    pubPageLayout.setFitToWidth(true);
    pubPageLayout.setContent(xPane);
    xPane.setId("pubScene");
    pubPageLayout.setId("gej");
    star.setId("starButton");
    eventLabel.setId("eventLabel");

    /*Items*/
    xPane.add(back, 1, 1);
    back.setId("button-logout");

    back.setOnAction(
        (event) -> {
          primaryStage.setScene(pubScene);
          xPane
              .getChildren()
              .removeAll(description, rating, overlay, pubName, map, star, rates, events);
          descriptionGrid
              .getChildren()
              .removeAll(age, open, address, type, discountForStudents, entranceFees);
          events.getChildren().removeAll(eventDescriptionGrid);
          eventDescriptionGrid.getChildren().removeAll(eventLabel, eventPane);
          eventPane.getChildren().removeAll(eventGrid);
          eventGrid.getChildren().removeAll(eventName, eventDescription);

          star.setText("0 \uF08A");
          star.setStyle(
              "#starButton{-fx-text-fill: #fff;}  #starButton:hover{-fx-text-fill: #fff;}");
        });
    /** End of Marco's work */

    /** Done by Shafiq & Antonino */
    star.setOnAction(
        event -> {
          int rate = PubDataAccessor.checkRate(this.id);
          int rateUpdate = rate + 1;
          /** End of Shafiq & Antonino's Work */

          /** Done by marco */
          star.setText((rateUpdate) + " \uF004");
          PubDataAccessor.updateRate(this.id);
          star.setStyle("-fx-text-fill: #731a2b;");
        });

    overlay.setHeight(header.getFitHeight());
    overlay.setWidth(header.getFitWidth() + 24);
    overlay.setX(0);
    overlay.setY(0);
    overlay.fillProperty().set(javafx.scene.paint.Color.rgb(115, 26, 43, 0.3));

    pubPage = new Scene(pubPageLayout, 1000, 600);
    pubPage.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm());
    /*Pub scene*/

    primaryStage.setScene(welcomeScene);
    primaryStage.show();
    Main.primaryStage = primaryStage;
    /** End of Marcos work */
  }